<!DOCTYPE HTML>
<html>
  <head>
    <meta charset="UTF-8">
    <title>TOMTOM</title>
    <script>
      // @JSON_VAR data
      var data = {
        "program": "Tomtom",
        "version": "5.0.2",
        "release": "Thu Aug 30 14:26:08 2018 -0700",
        "cmd": [
          "tomtom", "-oc", "tomtom/tomtom_meme_TCP7_2", "-dist", "pearson",
          "-no-ssc", "meme/meme-chip_TCP7_2/meme_out/meme.html",
          "/diska/database/jaspar/JASPAR2020_CORE_non-redundant_pfms_meme.txt"
        ],
        "options": {
          "strands": "both",
          "distance_measure": "pearson",
          "threshold_type": "qvalue",
          "threshold_value": 0.5,
          "background_source": "--query--"
        },
        "alphabet": {
          "name": "DNA",
          "like": "dna",
          "ncore": 4,
          "symbols": [
            {
              "symbol": "A",
              "name": "Adenine",
              "colour": "CC0000",
              "complement": "T"
            }, {
              "symbol": "C",
              "name": "Cytosine",
              "colour": "0000CC",
              "complement": "G"
            }, {
              "symbol": "G",
              "name": "Guanine",
              "colour": "FFB300",
              "complement": "C"
            }, {
              "symbol": "T",
              "aliases": "U",
              "name": "Thymine",
              "colour": "008000",
              "complement": "A"
            }, {
              "symbol": "N",
              "aliases": "X.",
              "name": "Any base",
              "equals": "ACGT"
            }, {
              "symbol": "V",
              "name": "Not T",
              "equals": "ACG"
            }, {
              "symbol": "H",
              "name": "Not G",
              "equals": "ACT"
            }, {
              "symbol": "D",
              "name": "Not C",
              "equals": "AGT"
            }, {
              "symbol": "B",
              "name": "Not A",
              "equals": "CGT"
            }, {
              "symbol": "M",
              "name": "Amino",
              "equals": "AC"
            }, {
              "symbol": "R",
              "name": "Purine",
              "equals": "AG"
            }, {
              "symbol": "W",
              "name": "Weak",
              "equals": "AT"
            }, {
              "symbol": "S",
              "name": "Strong",
              "equals": "CG"
            }, {
              "symbol": "Y",
              "name": "Pyrimidine",
              "equals": "CT"
            }, {
              "symbol": "K",
              "name": "Keto",
              "equals": "GT"
            }
          ]
        },
        "background": [0.278, 0.222, 0.222, 0.278],
        "query_dbs": [
          {
            "source": "meme/meme-chip_TCP7_2/meme_out/meme.html",
            "name": "meme.html",
            "loaded": 5,
            "excluded": 0,
            "last_modified": "Thu Mar 31 19:28:02 2022"
          }
        ],
        "target_dbs": [
          {
            "source": "/diska/database/jaspar/JASPAR2020_CORE_non-redundant_pfms_meme.txt",
            "name": "JASPAR2020_CORE_non-redundant_pfms_meme.txt",
            "loaded": 1646,
            "excluded": 0,
            "last_modified": "Sat May 30 02:18:37 2020"
          }
        ],
        "queries": [
          {
            "db": 0,
            "id": "CCTGAAACCCGRAGTA",
            "alt": "MEME-3",
            "len": 16,
            "nsites": 933,
            "evalue": "3.1e-1384",
            "pwm": [
              [0.00538822, 0.965622, 2.37917e-05, 0.0289657], 
              [0.0225354, 0.770573, 0.00538222, 0.201509], 
              [2.97932e-05, 0.00431033, 0.00323845, 0.99242], 
              [0.0814791, 0.00216756, 0.915253, 0.00110168], 
              [0.996708, 2.37917e-05, 0.00323845, 2.97932e-05], 
              [0.995636, 0.00431033, 2.37917e-05, 2.97932e-05], 
              [0.993492, 0.00216756, 2.37917e-05, 0.00431633], 
              [2.97932e-05, 0.857381, 2.37917e-05, 0.142566], 
              [0.00753199, 0.93883, 2.37917e-05, 0.053615], 
              [0.00860287, 0.916325, 2.37917e-05, 0.0750488], 
              [0.25295, 2.37917e-05, 0.740566, 0.0064601], 
              [0.451214, 0.00216756, 0.542303, 0.00431633], 
              [0.831667, 2.37917e-05, 0.16828, 2.97932e-05], 
              [0.141494, 0.00431033, 0.849879, 0.00431633], 
              [0.00538822, 0.00431033, 2.37917e-05, 0.990278], 
              [0.993492, 2.37917e-05, 0.0064541, 2.97932e-05]
            ]
          }, {
            "db": 0,
            "id": "CSTGYGGGGCCCACY",
            "alt": "MEME-1",
            "len": 15,
            "nsites": 2840,
            "evalue": "1.8e-3139",
            "pwm": [
              [0.0869787, 0.639422, 0.149299, 0.124301], 
              [0.175004, 0.269012, 0.404219, 0.151765], 
              [0.0845138, 0.225704, 0.102469, 0.587313], 
              [0.0852178, 0.0214861, 0.85702, 0.0362765], 
              [0.0324026, 0.425345, 0.021838, 0.520414], 
              [0.0158542, 7.81663e-06, 0.984128, 9.78838e-06], 
              [9.78838e-06, 7.81663e-06, 0.999973, 9.78838e-06], 
              [0.00317868, 7.81663e-06, 0.996804, 9.78838e-06], 
              [0.134864, 0.0563438, 0.678505, 0.130287], 
              [0.255283, 0.607732, 0.00388068, 0.133104], 
              [9.78838e-06, 0.999973, 7.81663e-06, 9.78838e-06], 
              [9.78838e-06, 0.98448, 7.81663e-06, 0.0155022], 
              [0.940822, 0.0151483, 0.0440203, 9.78838e-06], 
              [0.00212271, 0.902441, 0.0359216, 0.0595147], 
              [0.0971894, 0.524637, 0.0485981, 0.329575]
            ]
          }, {
            "db": 0,
            "id": "TGAAATTCGGGGTGG",
            "alt": "MEME-2",
            "len": 15,
            "nsites": 987,
            "evalue": "2.2e-1326",
            "pwm": [
              [0.0162375, 2.24901e-05, 0.167179, 0.816561], 
              [0.0689172, 2.24901e-05, 0.931032, 2.81633e-05], 
              [0.999927, 2.24901e-05, 2.24901e-05, 2.81633e-05], 
              [0.981692, 2.24901e-05, 0.0121793, 0.00610655], 
              [0.892542, 2.24901e-05, 0.093225, 0.0142107], 
              [0.00104106, 0.00711377, 2.24901e-05, 0.991823], 
              [2.81633e-05, 0.121591, 2.24901e-05, 0.878358], 
              [2.81633e-05, 0.786164, 0.00610087, 0.207707], 
              [0.090191, 0.00103539, 0.904693, 0.00408075], 
              [0.060812, 2.24901e-05, 0.914824, 0.0243417], 
              [0.0344727, 2.24901e-05, 0.965477, 2.81633e-05], 
              [0.070943, 2.24901e-05, 0.923941, 0.00509365], 
              [0.00408075, 0.0263618, 2.24901e-05, 0.969535], 
              [0.123623, 2.24901e-05, 0.876327, 2.81633e-05], 
              [0.0527078, 0.00204828, 0.945216, 2.81633e-05]
            ]
          }, {
            "db": 0,
            "id": "TTTCGGTAAATTTTCC",
            "alt": "MEME-4",
            "len": 16,
            "nsites": 1004,
            "evalue": "3.1e-1299",
            "pwm": [
              [0.00102359, 2.21094e-05, 0.00400571, 0.994949], 
              [0.00600309, 0.00699342, 0.00201391, 0.98499], 
              [0.0129744, 0.00400571, 0.00300981, 0.98001], 
              [0.016958, 0.783809, 0.00500161, 0.194231], 
              [0.286852, 2.21094e-05, 0.695172, 0.0179539], 
              [0.0398647, 2.21094e-05, 0.960085, 2.76865e-05], 
              [0.00301539, 0.00500161, 0.00500161, 0.986981], 
              [0.950132, 0.00201391, 0.0368714, 0.0109826], 
              [0.846557, 0.00599751, 0.110569, 0.036877], 
              [0.920255, 2.21094e-05, 0.00400571, 0.0757171], 
              [0.265937, 0.10061, 0.00500161, 0.628451], 
              [0.00201949, 0.0119729, 2.21094e-05, 0.985985], 
              [0.00301539, 0.127499, 2.21094e-05, 0.869463], 
              [0.00500719, 0.00599751, 0.00101801, 0.987977], 
              [2.76865e-05, 0.805719, 2.21094e-05, 0.194231], 
              [0.00500719, 0.860494, 2.21094e-05, 0.134476]
            ]
          }, {
            "db": 0,
            "id": "TYGGCATAACCTCCCT",
            "alt": "MEME-5",
            "len": 16,
            "nsites": 689,
            "evalue": "5.3e-863",
            "pwm": [
              [4.03425e-05, 3.2216e-05, 3.2216e-05, 0.999895], 
              [0.00439371, 0.56889, 3.2216e-05, 0.426683], 
              [0.209009, 3.2216e-05, 0.772054, 0.0189056], 
              [0.294628, 3.2216e-05, 0.703849, 0.00149113], 
              [0.00439371, 0.7053, 0.18288, 0.107427], 
              [0.966518, 0.0203483, 0.00873895, 0.00439371], 
              [0.271409, 0.00148301, 0.00148301, 0.725624], 
              [0.988286, 0.00438558, 0.00728816, 4.03425e-05], 
              [0.996993, 0.00148301, 3.2216e-05, 0.00149113], 
              [0.0058455, 0.68063, 3.2216e-05, 0.313493], 
              [0.00149113, 0.956352, 0.00148301, 0.0406734], 
              [4.03425e-05, 3.2216e-05, 3.2216e-05, 0.999895], 
              [0.0667937, 0.806882, 0.00293479, 0.123389], 
              [0.00439371, 0.907013, 0.00293479, 0.0856589], 
              [0.0131004, 0.895403, 3.2216e-05, 0.0914641], 
              [0.00149113, 0.036311, 0.00293479, 0.959262]
            ]
          }
        ],
        "targets": [
          {
            "db": 0,
            "id": "MA0123.1",
            "alt": "abi4",
            "len": 10,
            "nsites": 49,
            "url": "http://jaspar.genereg.net/matrix/MA0123.1",
            "pwm": [
              [0.000566191, 0.998415, 0.000452139, 0.000566191], 
              [0.244965, 0.000452139, 0.754016, 0.000566191], 
              [0.000566191, 0.407784, 0.591084, 0.000566191], 
              [0.000566191, 0.468884, 0.0208186, 0.509731], 
              [0.0209326, 0.0615514, 0.916949, 0.000566191], 
              [0.000566191, 0.916949, 0.0819189, 0.000566191], 
              [0.102399, 0.570717, 0.122652, 0.204233], 
              [0.0616655, 0.509617, 0.224485, 0.204233], 
              [0.0616655, 0.631817, 0.102285, 0.204233], 
              [0.0820329, 0.529983, 0.143018, 0.244965]
            ]
          }, {
            "db": 0,
            "id": "MA0163.1",
            "alt": "PLAG1",
            "len": 14,
            "nsites": 18,
            "url": "http://jaspar.genereg.net/matrix/MA0163.1",
            "pwm": [
              [0.00153591, 0.00122652, 0.995702, 0.00153591], 
              [0.167282, 0.00122652, 0.774707, 0.056785], 
              [0.00153591, 0.00122652, 0.995702, 0.00153591], 
              [0.00153591, 0.00122652, 0.940453, 0.056785], 
              [0.00153591, 0.774707, 0.222221, 0.00153591], 
              [0.00153591, 0.829955, 0.0564756, 0.112033], 
              [0.22253, 0.553713, 0.0564756, 0.167282], 
              [0.66452, 0.00122652, 0.00122652, 0.333027], 
              [0.609271, 0.27747, 0.111724, 0.00153591], 
              [0.112033, 0.00122652, 0.774707, 0.112033], 
              [0.00153591, 0.00122652, 0.995702, 0.00153591], 
              [0.00153591, 0.00122652, 0.995702, 0.00153591], 
              [0.00153591, 0.00122652, 0.885205, 0.112033], 
              [0.112033, 0.00122652, 0.885205, 0.00153591]
            ]
          }, {
            "db": 0,
            "id": "MA0213.1",
            "alt": "brk",
            "len": 8,
            "nsites": 10,
            "url": "http://jaspar.genereg.net/matrix/MA0213.1",
            "pwm": [
              [0.101762, 0.497248, 0.398238, 0.00275247], 
              [0.00275247, 0.398238, 0.00219802, 0.596812], 
              [0.00275247, 0.00219802, 0.992297, 0.00275247], 
              [0.00275247, 0.00219802, 0.992297, 0.00275247], 
              [0.00275247, 0.992297, 0.00219802, 0.00275247], 
              [0.101762, 0.00219802, 0.893287, 0.00275247], 
              [0.101762, 0.794277, 0.00219802, 0.101762], 
              [0.00275247, 0.497248, 0.101208, 0.398792]
            ]
          }, {
            "db": 0,
            "id": "MA0333.1",
            "alt": "MET31",
            "len": 9,
            "nsites": 101,
            "url": "http://jaspar.genereg.net/matrix/MA0333.1",
            "pwm": [
              [0.376141, 0.0991317, 0.376085, 0.148643], 
              [0.204155, 0.285651, 0.306039, 0.204155], 
              [0.138752, 0.138696, 0.178261, 0.54429], 
              [0.000274975, 0.000219585, 0.99923, 0.000274975], 
              [0.000274975, 0.000219585, 0.000219585, 0.999286], 
              [0.000274975, 0.000219585, 0.99923, 0.000274975], 
              [0.000274975, 0.000219585, 0.99923, 0.000274975], 
              [0.000274975, 0.99923, 0.000219585, 0.000274975], 
              [0.101185, 0.000219585, 0.6965, 0.202095]
            ]
          }, {
            "db": 0,
            "id": "MA0338.1",
            "alt": "MIG2",
            "len": 7,
            "nsites": 100,
            "url": "http://jaspar.genereg.net/matrix/MA0338.1",
            "pwm": [
              [0.0102677, 0.959263, 0.0202018, 0.0102677], 
              [0.000277722, 0.999223, 0.000221778, 0.000277722], 
              [0.000277722, 0.999223, 0.000221778, 0.000277722], 
              [0.000277722, 0.999223, 0.000221778, 0.000277722], 
              [0.359918, 0.110112, 0.519702, 0.0102677], 
              [0.0497333, 0.761836, 0.128806, 0.0596244], 
              [0.36355, 0.242404, 0.242404, 0.151641]
            ]
          }, {
            "db": 0,
            "id": "MA0339.1",
            "alt": "MIG3",
            "len": 7,
            "nsites": 101,
            "url": "http://jaspar.genereg.net/matrix/MA0339.1",
            "pwm": [
              [0.0101662, 0.969557, 0.0101108, 0.0101662], 
              [0.000274975, 0.93929, 0.000219585, 0.0602156], 
              [0.000274975, 0.99923, 0.000219585, 0.000274975], 
              [0.000274975, 0.99923, 0.000219585, 0.000274975], 
              [0.414006, 0.0204016, 0.555226, 0.010366], 
              [0.0502255, 0.689537, 0.170051, 0.090186], 
              [0.409869, 0.220002, 0.229992, 0.140136]
            ]
          }, {
            "db": 0,
            "id": "MA0375.1",
            "alt": "RSC30",
            "len": 8,
            "nsites": 100,
            "url": "http://jaspar.genereg.net/matrix/MA0375.1",
            "pwm": [
              [0.190088, 0.499722, 0.190032, 0.120158], 
              [0.151641, 0.383676, 0.464404, 0.000277722], 
              [0.000277722, 0.919303, 0.0801419, 0.000277722], 
              [0.000277722, 0.0801419, 0.919303, 0.000277722], 
              [0.000277722, 0.919303, 0.0801419, 0.000277722], 
              [0.000277722, 0.000221778, 0.999223, 0.000277722], 
              [0.000277722, 0.849373, 0.150072, 0.000277722], 
              [0.000277722, 0.309912, 0.689532, 0.000277722]
            ]
          }, {
            "db": 0,
            "id": "MA0395.1",
            "alt": "STP2",
            "len": 20,
            "nsites": 998,
            "url": "http://jaspar.genereg.net/matrix/MA0395.1",
            "pwm": [
              [0.180371, 0.258513, 0.175356, 0.385761], 
              [0.288866, 0.242726, 0.293875, 0.174534], 
              [0.438422, 0.193196, 0.211212, 0.157169], 
              [0.27683, 0.20963, 0.176535, 0.337005], 
              [0.126141, 0.405387, 0.143151, 0.32532], 
              [0.23872, 0.111345, 0.568671, 0.0812637], 
              [0.113243, 0.0110431, 0.8306, 0.0451133], 
              [0.0340924, 0.648254, 0.00503174, 0.312622], 
              [0.00203165, 0.00503174, 0.988901, 0.00403545], 
              [2.78529e-05, 0.850638, 0.148304, 0.00102975], 
              [0.00102975, 0.86767, 0.128266, 0.00303355], 
              [0.00804305, 0.0130469, 0.949827, 0.0290829], 
              [0.0140544, 0.521012, 0.00402984, 0.460904], 
              [0.619204, 0.012045, 0.338665, 0.0300848], 
              [0.0861052, 0.433412, 0.139147, 0.341335], 
              [0.218443, 0.312616, 0.359705, 0.109235], 
              [0.326648, 0.240479, 0.205413, 0.22746], 
              [0.231468, 0.427835, 0.161329, 0.179369], 
              [0.158329, 0.237473, 0.344677, 0.259521], 
              [0.343022, 0.265793, 0.122377, 0.268807]
            ]
          }, {
            "db": 0,
            "id": "MA0399.1",
            "alt": "SUT1",
            "len": 7,
            "nsites": 230,
            "url": "http://jaspar.genereg.net/matrix/MA0399.1",
            "pwm": [
              [0.100077, 0.617219, 0.15655, 0.126153], 
              [0.201714, 0.0210953, 0.77707, 0.000120817], 
              [0.000120817, 0.999662, 9.64799e-05, 0.000120817], 
              [0.0311153, 0.236428, 0.728462, 0.00399513], 
              [0.000120817, 0.169141, 0.830617, 0.000120817], 
              [0.208541, 0.148968, 0.64237, 0.000120817], 
              [0.189693, 0.0604153, 0.732537, 0.0173543]
            ]
          }, {
            "db": 0,
            "id": "MA0431.1",
            "alt": "TDA9",
            "len": 9,
            "nsites": 100,
            "url": "http://jaspar.genereg.net/matrix/MA0431.1",
            "pwm": [
              [0.319958, 0.239982, 0.229992, 0.210068], 
              [0.000277722, 0.999223, 0.000221778, 0.000277722], 
              [0.000277722, 0.999223, 0.000221778, 0.000277722], 
              [0.000277722, 0.999223, 0.000221778, 0.000277722], 
              [0.000277722, 0.999223, 0.000221778, 0.000277722], 
              [0.299978, 0.000221778, 0.359862, 0.339938], 
              [0.000277722, 0.999223, 0.000221778, 0.000277722], 
              [0.435487, 0.15848, 0.0298951, 0.37614], 
              [0.190088, 0.349872, 0.150072, 0.309968]
            ]
          }, {
            "db": 0,
            "id": "MA0436.1",
            "alt": "YPR022C",
            "len": 7,
            "nsites": 101,
            "url": "http://jaspar.genereg.net/matrix/MA0436.1",
            "pwm": [
              [0.148643, 0.653038, 0.000219585, 0.198099], 
              [0.000274975, 0.99923, 0.000219585, 0.000274975], 
              [0.000274975, 0.99923, 0.000219585, 0.000274975], 
              [0.000274975, 0.99923, 0.000219585, 0.000274975], 
              [0.999286, 0.000219585, 0.000219585, 0.000274975], 
              [0.000274975, 0.99923, 0.000219585, 0.000274975], 
              [0.227773, 0.257391, 0.336521, 0.178317]
            ]
          }, {
            "db": 0,
            "id": "MA0441.1",
            "alt": "ZMS1",
            "len": 9,
            "nsites": 100,
            "url": "http://jaspar.genereg.net/matrix/MA0441.1",
            "pwm": [
              [0.150128, 0.150072, 0.150072, 0.549728], 
              [0.313096, 0.111222, 0.111222, 0.46446], 
              [0.000277722, 0.999223, 0.000221778, 0.000277722], 
              [0.000277722, 0.999223, 0.000221778, 0.000277722], 
              [0.000277722, 0.999223, 0.000221778, 0.000277722], 
              [0.000277722, 0.999223, 0.000221778, 0.000277722], 
              [0.188209, 0.0397862, 0.534341, 0.237664], 
              [0.0502278, 0.849373, 0.0501718, 0.0502278], 
              [0.499778, 0.100122, 0.100122, 0.299978]
            ]
          }, {
            "db": 0,
            "id": "MA0493.1",
            "alt": "Klf1",
            "len": 11,
            "nsites": 526,
            "url": "http://jaspar.genereg.net/matrix/MA0493.1",
            "pwm": [
              [0.28517, 0.144502, 0.383999, 0.186329], 
              [0.317482, 0.0760737, 0.57978, 0.0266638], 
              [0.127405, 0.752751, 0.0608676, 0.0589766], 
              [0.0247631, 0.876302, 4.21973e-05, 0.0988931], 
              [0.767968, 0.224335, 4.21973e-05, 0.0076564], 
              [5.28416e-05, 0.999852, 4.21973e-05, 5.28416e-05], 
              [0.760364, 4.21973e-05, 0.184418, 0.0551754], 
              [5.28416e-05, 0.999852, 4.21973e-05, 5.28416e-05], 
              [5.28416e-05, 0.999852, 4.21973e-05, 5.28416e-05], 
              [5.28416e-05, 0.965638, 4.21973e-05, 0.0342673], 
              [0.532271, 0.0665695, 4.21973e-05, 0.401118]
            ]
          }, {
            "db": 0,
            "id": "MA0579.1",
            "alt": "CDC5",
            "len": 11,
            "nsites": 99,
            "url": "http://jaspar.genereg.net/matrix/MA0579.1",
            "pwm": [
              [0.282823, 0.242403, 0.32313, 0.151643], 
              [0.170109, 0.259962, 0.549669, 0.0202603], 
              [0.000280525, 0.919296, 0.0401837, 0.0402402], 
              [0.0202603, 0.0202038, 0.000224016, 0.959312], 
              [0.0608254, 0.857944, 0.000224016, 0.081007], 
              [0.918545, 0.0204056, 0.0204056, 0.0406438], 
              [0.0204621, 0.000224016, 0.93867, 0.0406438], 
              [0.0202603, 0.929286, 0.0501736, 0.000280525], 
              [0.0406438, 0.0405872, 0.918488, 0.000280525], 
              [0.0202603, 0.549669, 0.269952, 0.160119], 
              [0.180099, 0.229992, 0.44977, 0.140139]
            ]
          }, {
            "db": 0,
            "id": "MA0587.1",
            "alt": "TCP16",
            "len": 10,
            "nsites": 64,
            "url": "http://jaspar.genereg.net/matrix/MA0587.1",
            "pwm": [
              [0.0472356, 0.000346334, 0.936384, 0.0160343], 
              [0.0160343, 0.0471482, 0.000346334, 0.936471], 
              [0.000433697, 0.000346334, 0.998786, 0.000433697], 
              [0.000433697, 0.000346334, 0.998786, 0.000433697], 
              [0.499654, 0.125151, 0.234356, 0.140839], 
              [0.0160343, 0.936384, 0.0315476, 0.0160343], 
              [0.000433697, 0.998786, 0.000346334, 0.000433697], 
              [0.000433697, 0.998786, 0.000346334, 0.000433697], 
              [0.281245, 0.156353, 0.452764, 0.109638], 
              [0.187641, 0.312359, 0.405963, 0.0940374]
            ]
          }, {
            "db": 0,
            "id": "MA0599.1",
            "alt": "KLF5",
            "len": 10,
            "nsites": 13611,
            "url": "http://jaspar.genereg.net/matrix/MA0599.1",
            "pwm": [
              [0.10499, 0.148631, 0.556313, 0.190068], 
              [2.04245e-06, 0.874288, 1.63102e-06, 0.125708], 
              [2.04245e-06, 0.882223, 1.63102e-06, 0.117773], 
              [0.255455, 0.70303, 1.63102e-06, 0.0415127], 
              [2.04245e-06, 0.999994, 1.63102e-06, 2.04245e-06], 
              [0.371096, 1.63102e-06, 0.38072, 0.248182], 
              [2.04245e-06, 0.999994, 1.63102e-06, 2.04245e-06], 
              [2.04245e-06, 0.999994, 1.63102e-06, 2.04245e-06], 
              [2.04245e-06, 0.965023, 1.63102e-06, 0.0349738], 
              [0.287635, 0.411064, 1.63102e-06, 0.3013]
            ]
          }, {
            "db": 0,
            "id": "MA0646.1",
            "alt": "GCM1",
            "len": 11,
            "nsites": 21439,
            "url": "http://jaspar.genereg.net/matrix/MA0646.1",
            "pwm": [
              [0.117637, 0.398945, 0.240403, 0.243015], 
              [0.779003, 0.0658047, 0.145707, 0.00948525], 
              [0.00736926, 0.007049, 0.00439501, 0.981187], 
              [0.167479, 0.010499, 0.821446, 0.000576294], 
              [0.0419381, 0.897289, 0.0239409, 0.0368321], 
              [0.0227572, 0.00976999, 0.82132, 0.146153], 
              [1.2967e-06, 0.000187035, 0.99818, 0.00163129], 
              [1.2967e-06, 0.000839032, 0.998692, 0.000467295], 
              [0.00546427, 0.186798, 0.00550201, 0.802236], 
              [0.624514, 0.0846226, 0.232194, 0.058669], 
              [0.0368031, 0.625587, 0.225244, 0.112366]
            ]
          }, {
            "db": 0,
            "id": "MA0695.1",
            "alt": "ZBTB7C",
            "len": 12,
            "nsites": 1017,
            "url": "http://jaspar.genereg.net/matrix/MA0695.1",
            "pwm": [
              [0.267454, 0.116038, 0.455238, 0.16127], 
              [0.119937, 0.66706, 0.140899, 0.0721042], 
              [0.214816, 0.0783491, 0.622972, 0.0838621], 
              [0.79838, 0.176475, 0.00629621, 0.0188495], 
              [0.0369207, 0.96303, 2.18268e-05, 2.73326e-05], 
              [2.73326e-05, 0.981603, 0.00484335, 0.013526], 
              [0.780028, 0.206132, 0.00615122, 0.00768958], 
              [0.0170067, 0.960304, 0.00662518, 0.0160638], 
              [0.0719053, 0.813041, 0.0431486, 0.0719053], 
              [0.24853, 0.135568, 0.517653, 0.0982497], 
              [0.477466, 0.208256, 0.11774, 0.196537], 
              [0.327107, 0.309421, 0.192537, 0.170934]
            ]
          }, {
            "db": 0,
            "id": "MA0734.2",
            "alt": "GLI2",
            "len": 15,
            "nsites": 16444,
            "url": "http://jaspar.genereg.net/matrix/MA0734.2",
            "pwm": [
              [0.318292, 0.298042, 0.28594, 0.0977271], 
              [0.00518166, 0.0126573, 0.939306, 0.0428554], 
              [0.752185, 0.154002, 0.0938108, 1.69057e-06], 
              [1.69057e-06, 0.999508, 1.35003e-06, 0.000488688], 
              [1.69057e-06, 0.999934, 1.35003e-06, 6.26902e-05], 
              [0.936204, 0.0400941, 0.00576231, 0.0179396], 
              [1.69057e-06, 0.999995, 1.35003e-06, 1.69057e-06], 
              [0.180401, 0.819596, 1.35003e-06, 1.69057e-06], 
              [0.0100936, 0.979932, 0.000787345, 0.00918663], 
              [0.965956, 0.000419347, 0.0321902, 0.00143468], 
              [0.0663383, 0.849295, 0.0381431, 0.0462224], 
              [0.153586, 0.188341, 0.605594, 0.0524784], 
              [0.374599, 0.0890628, 0.160065, 0.376272], 
              [0.212548, 0.440756, 0.065518, 0.281178], 
              [0.0279185, 0.0697649, 0.859192, 0.0431254]
            ]
          }, {
            "db": 0,
            "id": "MA0735.1",
            "alt": "GLIS1",
            "len": 16,
            "nsites": 6069,
            "url": "http://jaspar.genereg.net/matrix/MA0735.1",
            "pwm": [
              [0.533198, 0.303509, 0.0164804, 0.146814], 
              [0.000314575, 0.00454858, 0.890175, 0.104962], 
              [0.997776, 3.65788e-06, 0.000951642, 0.00126856], 
              [4.58058e-06, 0.999571, 0.000419651, 4.58058e-06], 
              [0.000841567, 0.998103, 0.000422651, 0.00063257], 
              [4.58058e-06, 0.997699, 0.00229162, 4.58058e-06], 
              [0.00062657, 0.997915, 0.00103964, 0.000418574], 
              [4.58058e-06, 0.9985, 3.65788e-06, 0.00149156], 
              [0.00133256, 0.99711, 0.00111064, 0.000447573], 
              [0.975672, 0.000435651, 0.0230253, 0.000867566], 
              [4.58058e-06, 0.999987, 3.65788e-06, 4.58058e-06], 
              [0.000694569, 3.65788e-06, 0.994267, 0.0050345], 
              [0.736531, 0.000515649, 0.00409659, 0.258857], 
              [0.408202, 0.192197, 3.65788e-06, 0.399596], 
              [0.000733569, 0.000523649, 0.99624, 0.00250254], 
              [0.13638, 0.485992, 0.213877, 0.163751]
            ]
          }, {
            "db": 0,
            "id": "MA0736.1",
            "alt": "GLIS2",
            "len": 14,
            "nsites": 1621,
            "url": "http://jaspar.genereg.net/matrix/MA0736.1",
            "pwm": [
              [0.0456653, 0.110433, 0.573081, 0.27082], 
              [0.783206, 0.0905671, 0.125247, 0.000980089], 
              [0.00278698, 0.989796, 0.00278352, 0.00463386], 
              [0.00372392, 0.995318, 1.36944e-05, 0.000944092], 
              [0.00640975, 0.980775, 1.36944e-05, 0.0128014], 
              [0.00185404, 0.998115, 1.36944e-05, 1.71488e-05], 
              [0.0499691, 0.946431, 1.36944e-05, 0.00358493], 
              [0.0430605, 0.874132, 0.000841643, 0.0819661], 
              [0.296615, 0.00865216, 0.65872, 0.0360119], 
              [0.00255899, 0.915211, 0.0237412, 0.0584885], 
              [0.312668, 0.0245352, 0.619185, 0.0436115], 
              [0.503105, 0.0166447, 0.243242, 0.237009], 
              [0.414875, 0.27013, 0.114176, 0.20082], 
              [0.0114144, 0.142102, 0.798596, 0.0478862]
            ]
          }, {
            "db": 0,
            "id": "MA0737.1",
            "alt": "GLIS3",
            "len": 14,
            "nsites": 981,
            "url": "http://jaspar.genereg.net/matrix/MA0737.1",
            "pwm": [
              [0.0081825, 0.0418124, 0.687007, 0.262999], 
              [0.965605, 0.00459916, 0.0297676, 2.83355e-05], 
              [2.83355e-05, 0.993048, 0.00345828, 0.00346399], 
              [2.83355e-05, 0.999921, 2.26277e-05, 2.83355e-05], 
              [0.0062777, 0.965549, 2.26277e-05, 0.0281505], 
              [2.83355e-05, 0.996461, 2.26277e-05, 0.00348798], 
              [0.0196343, 0.980315, 2.26277e-05, 2.83355e-05], 
              [2.83355e-05, 0.91335, 2.26277e-05, 0.0865995], 
              [0.919977, 0.00106052, 0.0695895, 0.00937338], 
              [0.00437589, 0.886889, 0.0348021, 0.0739338], 
              [0.233235, 0.0175648, 0.668685, 0.0805151], 
              [0.815045, 0.00310431, 0.0477838, 0.134067], 
              [0.692021, 0.177783, 0.0127193, 0.117476], 
              [2.83355e-05, 0.025498, 0.968077, 0.00639669]
            ]
          }, {
            "db": 0,
            "id": "MA0738.1",
            "alt": "HIC2",
            "len": 9,
            "nsites": 5652,
            "url": "http://jaspar.genereg.net/matrix/MA0738.1",
            "pwm": [
              [0.461073, 0.0697127, 0.404279, 0.0649368], 
              [4.91852e-06, 0.0233665, 3.92775e-06, 0.976625], 
              [0.0838744, 0.0601049, 0.830379, 0.0256415], 
              [0.00467184, 0.992478, 0.00284488, 4.91852e-06], 
              [0.0807835, 0.908252, 3.92775e-06, 0.0109607], 
              [0.299734, 0.700258, 3.92775e-06, 4.91852e-06], 
              [0.509604, 0.145136, 0.263695, 0.0815655], 
              [0.157434, 0.449802, 0.252913, 0.139851], 
              [0.155389, 0.354118, 0.204662, 0.285831]
            ]
          }, {
            "db": 0,
            "id": "MA0739.1",
            "alt": "Hic1",
            "len": 9,
            "nsites": 12392,
            "url": "http://jaspar.genereg.net/matrix/MA0739.1",
            "pwm": [
              [0.511376, 0.0580223, 0.376855, 0.0537458], 
              [0.0053632, 0.0364945, 0.00631474, 0.951828], 
              [0.0746406, 0.0461984, 0.864781, 0.0143801], 
              [0.00447521, 0.984696, 0.0108267, 2.24336e-06], 
              [0.00786318, 0.983289, 0.00277077, 0.00607719], 
              [0.795264, 0.176481, 0.000266789, 0.027988], 
              [0.557825, 0.180431, 0.20596, 0.0557848], 
              [0.0795116, 0.717345, 0.106166, 0.0969775], 
              [0.146258, 0.438043, 0.171148, 0.244549]
            ]
          }, {
            "db": 0,
            "id": "MA0746.2",
            "alt": "SP3",
            "len": 13,
            "nsites": 6591,
            "url": "http://jaspar.genereg.net/matrix/MA0746.2",
            "pwm": [
              [0.192233, 0.285843, 0.287512, 0.234412], 
              [0.284502, 0.0703983, 0.589282, 0.0558164], 
              [0.0848479, 0.842184, 0.0288809, 0.0440875], 
              [0.0228379, 0.94062, 0.00771025, 0.0288318], 
              [0.795419, 0.202604, 0.000306364, 0.00167019], 
              [0.000912204, 0.997264, 3.36818e-06, 0.00182019], 
              [0.0615113, 3.36818e-06, 0.871815, 0.0666702], 
              [4.21781e-06, 0.999988, 3.36818e-06, 4.21781e-06], 
              [4.21781e-06, 0.998624, 3.36818e-06, 0.0013682], 
              [0.000277214, 0.901262, 0.000276364, 0.0981837], 
              [0.477646, 0.440047, 0.00543429, 0.0768731], 
              [0.0746941, 0.687258, 0.0399008, 0.198147], 
              [0.230012, 0.395688, 0.0795042, 0.294796]
            ]
          }, {
            "db": 0,
            "id": "MA0747.1",
            "alt": "SP8",
            "len": 12,
            "nsites": 167,
            "url": "http://jaspar.genereg.net/matrix/MA0747.1",
            "pwm": [
              [0.311357, 0.161713, 0.466919, 0.0600105], 
              [0.315766, 0.660556, 0.000132855, 0.0235444], 
              [0.122044, 0.814279, 0.000132855, 0.0635434], 
              [0.786677, 0.195282, 0.00604631, 0.0119933], 
              [0.0390321, 0.927356, 0.00568553, 0.0279277], 
              [0.0933945, 0.13811, 0.622894, 0.145601], 
              [0.0279277, 0.927356, 0.0334459, 0.0112707], 
              [0.0117874, 0.970482, 0.0175644, 0.000166367], 
              [0.000166367, 0.897445, 0.021625, 0.0807631], 
              [0.511224, 0.437371, 0.0342035, 0.0172012], 
              [0.054301, 0.695549, 0.0875805, 0.162569], 
              [0.186802, 0.313198, 0.00615325, 0.493847]
            ]
          }, {
            "db": 0,
            "id": "MA1019.1",
            "alt": "Glyma19g26560.1",
            "len": 9,
            "nsites": 1001,
            "url": "http://jaspar.genereg.net/matrix/MA1019.1",
            "pwm": [
              [0.103913, 0.198803, 0.479494, 0.217788], 
              [0.0190259, 0.0140208, 0.907931, 0.0590219], 
              [0.0861052, 0.0190393, 0.861798, 0.0330575], 
              [0.109017, 0.306992, 0.439978, 0.144013], 
              [0.0420236, 0.881934, 0.0270195, 0.0490229], 
              [0.00302747, 0.995923, 0.00102208, 2.77694e-05], 
              [0.00402737, 0.975925, 2.21756e-05, 0.0200258], 
              [0.895938, 0.0170205, 0.0760146, 0.0110267], 
              [0.0170261, 0.843938, 0.0500172, 0.0890189]
            ]
          }, {
            "db": 0,
            "id": "MA1031.1",
            "alt": "OJ1581_H09.2",
            "len": 10,
            "nsites": 999,
            "url": "http://jaspar.genereg.net/matrix/MA1031.1",
            "pwm": [
              [0.175185, 0.13114, 0.414395, 0.279279], 
              [0.0740204, 0.146008, 0.334989, 0.444983], 
              [2.7825e-05, 2.222e-05, 0.928929, 0.0710207], 
              [2.7825e-05, 2.222e-05, 0.999922, 2.7825e-05], 
              [0.126888, 0.100911, 0.660296, 0.111905], 
              [0.111905, 0.660296, 0.100911, 0.126888], 
              [2.7825e-05, 0.999922, 2.222e-05, 2.7825e-05], 
              [0.0710207, 0.928929, 2.222e-05, 2.7825e-05], 
              [0.444983, 0.334989, 0.146008, 0.0740204], 
              [0.279279, 0.414395, 0.13114, 0.175185]
            ]
          }, {
            "db": 0,
            "id": "MA1035.1",
            "alt": "TCP4",
            "len": 8,
            "nsites": 1000,
            "url": "http://jaspar.genereg.net/matrix/MA1035.1",
            "pwm": [
              [0.112017, 0.0010221, 0.774945, 0.112017], 
              [0.0010267, 0.0010211, 0.996926, 0.0010267], 
              [0.0010267, 0.0010211, 0.996926, 0.0010267], 
              [0.830945, 0.167005, 0.0010221, 0.0010277], 
              [0.0010267, 0.996926, 0.0010211, 0.0010267], 
              [0.0010267, 0.996926, 0.0010211, 0.0010267], 
              [0.996928, 0.0010221, 0.0010221, 0.0010277], 
              [0.0010287, 0.99692, 0.0010231, 0.0010287]
            ]
          }, {
            "db": 0,
            "id": "MA1050.1",
            "alt": "OsI_08196",
            "len": 8,
            "nsites": 1001,
            "url": "http://jaspar.genereg.net/matrix/MA1050.1",
            "pwm": [
              [0.00102667, 0.00102108, 0.944983, 0.0529695], 
              [0.0460692, 2.21756e-05, 0.953881, 2.77694e-05], 
              [0.0911097, 0.0911041, 0.726677, 0.0911097], 
              [2.77694e-05, 0.862936, 0.0460176, 0.0910187], 
              [2.77694e-05, 0.999922, 2.21756e-05, 2.77694e-05], 
              [2.77694e-05, 0.999922, 2.21756e-05, 2.77694e-05], 
              [0.899838, 0.0500672, 0.0500672, 2.77694e-05], 
              [0.00102767, 0.854937, 0.072015, 0.0720206]
            ]
          }, {
            "db": 0,
            "id": "MA1054.1",
            "alt": "ARALYDRAFT_897773",
            "len": 10,
            "nsites": 1000,
            "url": "http://jaspar.genereg.net/matrix/MA1054.1",
            "pwm": [
              [0.0920186, 0.277994, 0.167005, 0.462982], 
              [0.0270521, 0.0790933, 0.491464, 0.40239], 
              [0.0360242, 0.0040218, 0.876935, 0.0830195], 
              [0.0170261, 0.0070215, 0.956927, 0.0190259], 
              [0.0400238, 0.12501, 0.82594, 0.0090269], 
              [0.755952, 0.215001, 0.0070215, 0.0220256], 
              [0.0020276, 0.948927, 0.0470175, 0.0020276], 
              [0.0010287, 0.995919, 0.002024, 0.0010287], 
              [0.861942, 0.002022, 0.132009, 0.0040274], 
              [0.0200258, 0.906932, 0.0060216, 0.0670211]
            ]
          }, {
            "db": 0,
            "id": "MA1062.2",
            "alt": "TCP15",
            "len": 19,
            "nsites": 827,
            "url": "http://jaspar.genereg.net/matrix/MA1062.2",
            "pwm": [
              [0.338566, 0.170502, 0.206773, 0.284159], 
              [0.30713, 0.220073, 0.192265, 0.280532], 
              [0.442543, 0.153575, 0.154784, 0.249096], 
              [0.34582, 0.170502, 0.191056, 0.292622], 
              [0.119729, 0.0520156, 0.797995, 0.03026], 
              [0.013333, 0.0495978, 0.0121174, 0.924952], 
              [0.0931304, 0.00486326, 0.889883, 0.0121241], 
              [0.00245132, 0.00123569, 0.99507, 0.00124247], 
              [0.0290511, 0.0036544, 0.952754, 0.0145419], 
              [0.3833, 0.162038, 0.163248, 0.291413], 
              [0.013333, 0.949126, 0.00486326, 0.0326777], 
              [0.00366117, 0.992652, 0.00123569, 0.00245132], 
              [0.00970644, 0.885047, 0.00607211, 0.0991756], 
              [0.921325, 0.00728096, 0.0580608, 0.013333], 
              [0.0326777, 0.790741, 0.0556431, 0.120938], 
              [0.297459, 0.189847, 0.165666, 0.347029], 
              [0.256351, 0.160829, 0.140276, 0.442543], 
              [0.297459, 0.188638, 0.205564, 0.308339], 
              [0.286577, 0.211609, 0.169293, 0.33252]
            ]
          }, {
            "db": 0,
            "id": "MA1063.1",
            "alt": "TCP19",
            "len": 10,
            "nsites": 1000,
            "url": "http://jaspar.genereg.net/matrix/MA1063.1",
            "pwm": [
              [0.148013, 0.221, 0.181004, 0.449983], 
              [0.137014, 0.151007, 0.505972, 0.206007], 
              [0.0320246, 0.0070215, 0.845938, 0.115016], 
              [0.112017, 0.0570165, 0.777944, 0.0530225], 
              [0.190009, 0.282994, 0.408981, 0.118016], 
              [0.109017, 0.738948, 0.02202, 0.130015], 
              [0.0130265, 0.960926, 0.0010221, 0.0250253], 
              [2.77972e-05, 0.998922, 2.21978e-05, 0.0010277], 
              [0.840944, 0.0290193, 0.128009, 0.0020276], 
              [2.77972e-05, 0.812754, 0.106118, 0.0811007]
            ]
          }, {
            "db": 0,
            "id": "MA1064.1",
            "alt": "TCP2",
            "len": 10,
            "nsites": 1000,
            "url": "http://jaspar.genereg.net/matrix/MA1064.1",
            "pwm": [
              [0.217006, 0.168005, 0.428979, 0.186009], 
              [0.088019, 0.194003, 0.154007, 0.563971], 
              [0.0350243, 2.21978e-05, 0.843938, 0.121016], 
              [2.77972e-05, 2.21978e-05, 0.980924, 0.0190259], 
              [0.068021, 0.0780144, 0.52097, 0.332995], 
              [0.332995, 0.52097, 0.0780144, 0.068021], 
              [0.0190259, 0.980924, 2.21978e-05, 2.77972e-05], 
              [0.121016, 0.843938, 2.21978e-05, 0.0350243], 
              [0.563971, 0.154007, 0.194003, 0.088019], 
              [0.186009, 0.428979, 0.168005, 0.217006]
            ]
          }, {
            "db": 0,
            "id": "MA1065.2",
            "alt": "TCP20",
            "len": 19,
            "nsites": 970,
            "url": "http://jaspar.genereg.net/matrix/MA1065.2",
            "pwm": [
              [0.338138, 0.175263, 0.221649, 0.264949], 
              [0.312367, 0.235051, 0.192787, 0.259796], 
              [0.418543, 0.170108, 0.160831, 0.250518], 
              [0.342261, 0.181447, 0.204126, 0.272166], 
              [0.109295, 0.0536254, 0.790663, 0.0464159], 
              [0.0196146, 0.0546563, 0.0123926, 0.913337], 
              [0.0794015, 0.00723814, 0.904054, 0.0093057], 
              [0.00415223, 0.00105378, 0.991674, 0.00312134], 
              [0.0381687, 0.00311557, 0.942194, 0.016522], 
              [0.39071, 0.162893, 0.163924, 0.282474], 
              [0.0134293, 0.943225, 0.00414646, 0.0391996], 
              [0.00415223, 0.991674, 2.28843e-05, 0.00415223], 
              [0.0093057, 0.903023, 0.00414646, 0.083525], 
              [0.914367, 0.00826903, 0.0629034, 0.0144602], 
              [0.0361069, 0.792725, 0.0618725, 0.109295], 
              [0.369063, 0.186602, 0.177325, 0.267011], 
              [0.280412, 0.149492, 0.161862, 0.408234], 
              [0.285566, 0.186602, 0.221649, 0.306183], 
              [0.279381, 0.228865, 0.162893, 0.328861]
            ]
          }, {
            "db": 0,
            "id": "MA1066.1",
            "alt": "TCP23",
            "len": 8,
            "nsites": 1000,
            "url": "http://jaspar.genereg.net/matrix/MA1066.1",
            "pwm": [
              [0.0050273, 0.0030219, 0.965926, 0.0260252], 
              [0.0100268, 0.0050217, 0.979924, 0.0050273], 
              [0.0369871, 0.0879254, 0.834105, 0.0409827], 
              [0.0070341, 0.971897, 0.0080294, 0.0130395], 
              [0.0040274, 0.983924, 0.0080214, 0.0040274], 
              [0.0120146, 0.978945, 0.0030189, 0.0060212], 
              [0.953932, 0.0100212, 0.0310191, 0.0050273], 
              [0.0100168, 0.957968, 0.0110101, 0.0210047]
            ]
          }, {
            "db": 0,
            "id": "MA1067.1",
            "alt": "TCP5",
            "len": 8,
            "nsites": 999,
            "url": "http://jaspar.genereg.net/matrix/MA1067.1",
            "pwm": [
              [0.00202962, 0.00202402, 0.993917, 0.00202962], 
              [0.00202563, 0.00202002, 0.993929, 0.00202563], 
              [0.00202563, 0.00202002, 0.993929, 0.00202563], 
              [0.993934, 0.00202002, 0.00202002, 0.00202563], 
              [0.00202563, 0.993929, 0.00202002, 0.00202563], 
              [0.00202563, 0.993929, 0.00202002, 0.00202563], 
              [0.993934, 0.00202002, 0.00202002, 0.00202563], 
              [0.00202962, 0.745694, 0.00202402, 0.250253]
            ]
          }, {
            "db": 0,
            "id": "MA1095.1",
            "alt": "ARALYDRAFT_495258",
            "len": 8,
            "nsites": 999,
            "url": "http://jaspar.genereg.net/matrix/MA1095.1",
            "pwm": [
              [0.00202962, 0.00202402, 0.993917, 0.00202962], 
              [0.250253, 0.00202402, 0.745694, 0.00202962], 
              [0.00202762, 0.497972, 0.497972, 0.00202762], 
              [0.00202962, 0.993917, 0.00202402, 0.00202962], 
              [0.00202962, 0.993917, 0.00202402, 0.00202962], 
              [0.00202962, 0.993917, 0.00202402, 0.00202962], 
              [0.993922, 0.00202402, 0.00202402, 0.00202962], 
              [0.00303052, 0.990914, 0.00302492, 0.00303052]
            ]
          }, {
            "db": 0,
            "id": "MA1096.1",
            "alt": "ARALYDRAFT_496250",
            "len": 8,
            "nsites": 999,
            "url": "http://jaspar.genereg.net/matrix/MA1096.1",
            "pwm": [
              [0.00303052, 0.00302492, 0.990914, 0.00303052], 
              [0.00202762, 0.00202202, 0.993923, 0.00202762], 
              [0.00202762, 0.00202202, 0.993923, 0.00202762], 
              [0.993928, 0.00202202, 0.00202202, 0.00202762], 
              [0.00202762, 0.993923, 0.00202202, 0.00202762], 
              [0.00202762, 0.993923, 0.00202202, 0.00202762], 
              [0.993928, 0.00202202, 0.00202202, 0.00202762], 
              [0.00303052, 0.990914, 0.00302492, 0.00303052]
            ]
          }, {
            "db": 0,
            "id": "MA1097.1",
            "alt": "ARALYDRAFT_493022",
            "len": 8,
            "nsites": 999,
            "url": "http://jaspar.genereg.net/matrix/MA1097.1",
            "pwm": [
              [0.00303052, 0.00302492, 0.990914, 0.00303052], 
              [0.00303052, 0.00302492, 0.990914, 0.00303052], 
              [0.00303052, 0.332321, 0.661618, 0.00303052], 
              [0.332327, 0.661618, 0.00302492, 0.00303052], 
              [0.00303052, 0.990914, 0.00302492, 0.00303052], 
              [0.00303052, 0.990914, 0.00302492, 0.00303052], 
              [0.99092, 0.00302492, 0.00302492, 0.00303052], 
              [0.00502732, 0.984924, 0.00502172, 0.00502732]
            ]
          }, {
            "db": 0,
            "id": "MA1098.1",
            "alt": "ARALYDRAFT_484486",
            "len": 8,
            "nsites": 999,
            "url": "http://jaspar.genereg.net/matrix/MA1098.1",
            "pwm": [
              [0.00202962, 0.00202402, 0.993917, 0.00202962], 
              [0.250253, 0.00202402, 0.745694, 0.00202962], 
              [0.00202762, 0.497972, 0.497972, 0.00202762], 
              [0.00202962, 0.993917, 0.00202402, 0.00202962], 
              [0.00202962, 0.993917, 0.00202402, 0.00202962], 
              [0.00202962, 0.993917, 0.00202402, 0.00202962], 
              [0.993922, 0.00202402, 0.00202402, 0.00202962], 
              [0.00303052, 0.990914, 0.00302492, 0.00303052]
            ]
          }, {
            "db": 0,
            "id": "MA1282.1",
            "alt": "PTF1",
            "len": 13,
            "nsites": 130,
            "url": "http://jaspar.genereg.net/matrix/MA1282.1",
            "pwm": [
              [0.130882, 0.0693484, 0.738065, 0.0617044], 
              [0.0463322, 0.0847206, 0.0539752, 0.814972], 
              [0.0847636, 0.0693484, 0.745751, 0.100137], 
              [0.000213682, 0.000170638, 0.991716, 0.00789977], 
              [0.000213682, 0.000170638, 0.999402, 0.000213682], 
              [0.000213682, 0.000170638, 0.999402, 0.000213682], 
              [0.761166, 0.161584, 0.000170638, 0.0770776], 
              [0.000213682, 0.991716, 0.000170638, 0.00789977], 
              [0.000213682, 0.999402, 0.000170638, 0.000213682], 
              [0.922581, 0.000170638, 0.0770345, 0.000213682], 
              [0.000213682, 0.899479, 0.0462892, 0.0540183], 
              [0.438339, 0.123153, 0.0924077, 0.346102], 
              [0.384533, 0.0770345, 0.207703, 0.330728]
            ]
          }, {
            "db": 0,
            "id": "MA1283.1",
            "alt": "TCP14",
            "len": 20,
            "nsites": 47,
            "url": "http://jaspar.genereg.net/matrix/MA1283.1",
            "pwm": [
              [0.658764, 0.106628, 0.106628, 0.127979], 
              [0.276599, 0.340175, 0.27648, 0.106747], 
              [0.849847, 0.000471338, 0.0853966, 0.0642847], 
              [0.29783, 0.042934, 0.382637, 0.276599], 
              [0.764921, 0.042934, 0.0853966, 0.106747], 
              [0.106747, 0.106628, 0.594951, 0.191673], 
              [0.212905, 0.297711, 0.382637, 0.106747], 
              [0.467681, 0.042934, 0.255248, 0.234136], 
              [0.0430529, 0.212786, 0.340175, 0.403987], 
              [0.000590233, 0.000471338, 0.998348, 0.000590233], 
              [0.000590233, 0.000471338, 0.000471338, 0.998467], 
              [0.0430529, 0.000471338, 0.955886, 0.000590233], 
              [0.000590233, 0.000471338, 0.998348, 0.000590233], 
              [0.000590233, 0.000471338, 0.998348, 0.000590233], 
              [0.403987, 0.000471338, 0.382637, 0.212905], 
              [0.000590233, 0.998348, 0.000471338, 0.000590233], 
              [0.000590233, 0.998348, 0.000471338, 0.000590233], 
              [0.000590233, 0.998348, 0.000471338, 0.000590233], 
              [0.913542, 0.000471338, 0.0853966, 0.000590233], 
              [0.000590233, 0.998348, 0.000471338, 0.000590233]
            ]
          }, {
            "db": 0,
            "id": "MA1284.1",
            "alt": "TCP1",
            "len": 30,
            "nsites": 95,
            "url": "http://jaspar.genereg.net/matrix/MA1284.1",
            "pwm": [
              [0.378841, 0.07384, 0.168477, 0.378841], 
              [0.042353, 0.07384, 0.883515, 0.000292324], 
              [0.000292324, 0.063325, 0.0528101, 0.883574], 
              [0.000292324, 0.000233439, 0.999182, 0.000292324], 
              [0.000292324, 0.000233439, 0.999182, 0.000292324], 
              [0.000292324, 0.000233439, 0.999182, 0.000292324], 
              [0.0844148, 0.568057, 0.0843559, 0.263174], 
              [0.000292324, 0.988667, 0.0107484, 0.000292324], 
              [0.000292324, 0.999182, 0.000233439, 0.000292324], 
              [0.0949297, 0.862484, 0.000233439, 0.042353], 
              [0.547085, 0.27363, 0.0843559, 0.0949297], 
              [0.158021, 0.641663, 0.0212643, 0.179051], 
              [0.168536, 0.357752, 0.231569, 0.242143], 
              [0.13699, 0.231569, 0.126417, 0.505024], 
              [0.221113, 0.389298, 0.157962, 0.231628], 
              [0.210597, 0.357752, 0.105386, 0.326265], 
              [0.168536, 0.294661, 0.0843559, 0.452448], 
              [0.242143, 0.452389, 0.115901, 0.189567], 
              [0.263174, 0.189508, 0.126417, 0.420903], 
              [0.168536, 0.326206, 0.263115, 0.242143], 
              [0.231628, 0.231569, 0.178992, 0.357811], 
              [0.242143, 0.27363, 0.115901, 0.368326], 
              [0.158021, 0.136932, 0.378782, 0.326265], 
              [0.210597, 0.115901, 0.420844, 0.252659], 
              [0.158021, 0.157962, 0.378782, 0.305234], 
              [0.294719, 0.378782, 0.105386, 0.221113], 
              [0.200082, 0.389298, 0.157962, 0.252659], 
              [0.231628, 0.284146, 0.189508, 0.294719], 
              [0.378841, 0.200023, 0.221054, 0.200082], 
              [0.126475, 0.368267, 0.0843559, 0.420903]
            ]
          }, {
            "db": 0,
            "id": "MA1285.1",
            "alt": "At2g45680",
            "len": 21,
            "nsites": 395,
            "url": "http://jaspar.genereg.net/matrix/MA1285.1",
            "pwm": [
              [0.194958, 0.486009, 0.151917, 0.167117], 
              [0.215206, 0.518912, 0.144324, 0.121559], 
              [0.493616, 0.200006, 0.129138, 0.177241], 
              [0.164586, 0.225315, 0.124076, 0.486023], 
              [0.12662, 0.139262, 0.197474, 0.536644], 
              [0.260763, 0.146854, 0.106358, 0.486023], 
              [0.164586, 0.232908, 0.382237, 0.220268], 
              [0.232922, 0.430327, 0.075986, 0.260763], 
              [0.225329, 0.420203, 0.0861104, 0.268356], 
              [0.116497, 0.0329589, 0.840349, 0.0101948], 
              [0.00260172, 0.048145, 0.00258755, 0.946666], 
              [0.0405661, 5.61883e-05, 0.959307, 7.03619e-05], 
              [0.00260172, 5.61883e-05, 0.997272, 7.03619e-05], 
              [0.060814, 5.61883e-05, 0.936528, 0.00260172], 
              [0.134213, 0.245564, 0.0582695, 0.561953], 
              [7.03619e-05, 0.982086, 5.61883e-05, 0.0177879], 
              [0.00513208, 0.994741, 5.61883e-05, 7.03619e-05], 
              [0.00260172, 0.939059, 0.00258755, 0.0557523], 
              [0.901108, 0.00258755, 0.0962348, 7.03619e-05], 
              [0.00513208, 0.875783, 0.0278971, 0.0911863], 
              [0.263295, 0.450575, 0.0911721, 0.194958]
            ]
          }, {
            "db": 0,
            "id": "MA1286.1",
            "alt": "TCP24",
            "len": 12,
            "nsites": 594,
            "url": "http://jaspar.genereg.net/matrix/MA1286.1",
            "pwm": [
              [0.257579, 0.136378, 0.360246, 0.245796], 
              [0.190251, 0.181825, 0.15826, 0.469665], 
              [0.124605, 0.168359, 0.329948, 0.377087], 
              [0.0202454, 0.0185533, 0.930857, 0.0303447], 
              [4.67934e-05, 3.73675e-05, 0.998185, 0.00173051], 
              [4.67934e-05, 3.73675e-05, 0.999869, 4.67934e-05], 
              [0.887102, 0.0404346, 0.043801, 0.028662], 
              [4.67934e-05, 0.999869, 3.73675e-05, 4.67934e-05], 
              [4.67934e-05, 0.999869, 3.73675e-05, 4.67934e-05], 
              [0.954431, 3.73675e-05, 0.0454847, 4.67934e-05], 
              [0.0269783, 0.94264, 0.0151868, 0.0151962], 
              [0.328275, 0.323215, 0.067366, 0.281144]
            ]
          }, {
            "db": 0,
            "id": "MA1287.1",
            "alt": "TCP21",
            "len": 14,
            "nsites": 598,
            "url": "http://jaspar.genereg.net/matrix/MA1287.1",
            "pwm": [
              [0.314375, 0.128779, 0.165561, 0.391285], 
              [0.0585647, 0.00839672, 0.932991, 4.64805e-05], 
              [4.64805e-05, 0.0334765, 3.71176e-05, 0.96644], 
              [4.64805e-05, 3.71176e-05, 0.99987, 4.64805e-05], 
              [4.64805e-05, 3.71176e-05, 0.99987, 4.64805e-05], 
              [0.0903324, 0.00170884, 0.869457, 0.038502], 
              [0.257528, 0.483234, 0.0552119, 0.204025], 
              [4.64805e-05, 0.998198, 3.71176e-05, 0.0017182], 
              [0.0251263, 0.973118, 3.71176e-05, 0.0017182], 
              [0.103708, 0.693901, 0.0234442, 0.178947], 
              [0.708958, 0.0618998, 0.14717, 0.0819728], 
              [0.0970203, 0.56516, 0.108715, 0.229105], 
              [0.255857, 0.250831, 0.197328, 0.295984], 
              [0.269232, 0.173921, 0.160545, 0.396301]
            ]
          }, {
            "db": 0,
            "id": "MA1288.1",
            "alt": "At1g72010",
            "len": 13,
            "nsites": 595,
            "url": "http://jaspar.genereg.net/matrix/MA1288.1",
            "pwm": [
              [0.381496, 0.156314, 0.1832, 0.278992], 
              [0.277311, 0.146231, 0.188241, 0.388216], 
              [0.0202113, 0.00339774, 0.976344, 4.67148e-05], 
              [4.67148e-05, 0.0420472, 3.73047e-05, 0.957869], 
              [0.00172743, 3.73047e-05, 0.998189, 4.67148e-05], 
              [4.67148e-05, 3.73047e-05, 0.999869, 4.67148e-05], 
              [0.0958286, 0.00507846, 0.862077, 0.0370155], 
              [0.289074, 0.381486, 0.0974999, 0.231941], 
              [4.67148e-05, 0.999869, 3.73047e-05, 4.67148e-05], 
              [0.00172743, 0.998189, 3.73047e-05, 4.67148e-05], 
              [0.075664, 0.737728, 0.0151608, 0.171447], 
              [0.741098, 0.0420472, 0.146231, 0.0706229], 
              [0.0857463, 0.539443, 0.117665, 0.257147]
            ]
          }, {
            "db": 0,
            "id": "MA1289.1",
            "alt": "TCP3",
            "len": 13,
            "nsites": 582,
            "url": "http://jaspar.genereg.net/matrix/MA1289.1",
            "pwm": [
              [0.283504, 0.118575, 0.359083, 0.238839], 
              [0.209634, 0.16324, 0.132317, 0.494808], 
              [0.0996866, 0.152933, 0.317853, 0.429527], 
              [0.00348317, 0.00347355, 0.967226, 0.0258163], 
              [4.77581e-05, 3.81378e-05, 0.999866, 4.77581e-05], 
              [4.77581e-05, 3.81378e-05, 0.999866, 4.77581e-05], 
              [0.86416, 0.0876521, 3.81378e-05, 0.0481495], 
              [4.77581e-05, 0.999866, 3.81378e-05, 4.77581e-05], 
              [4.77581e-05, 0.999866, 3.81378e-05, 4.77581e-05], 
              [0.934595, 3.81378e-05, 0.0653189, 4.77581e-05], 
              [0.00176546, 0.963791, 0.0103454, 0.0240986], 
              [0.3694, 0.264598, 0.0876521, 0.278351], 
              [0.33676, 0.127164, 0.178701, 0.357374]
            ]
          }, {
            "db": 0,
            "id": "MA1290.1",
            "alt": "TCP17",
            "len": 11,
            "nsites": 108,
            "url": "http://jaspar.genereg.net/matrix/MA1290.1",
            "pwm": [
              [0.0742626, 0.05571, 0.851269, 0.018759], 
              [0.018759, 0.0464585, 0.000205366, 0.934577], 
              [0.000257169, 0.0187072, 0.971528, 0.0095076], 
              [0.000257169, 0.000205366, 0.980778, 0.018759], 
              [0.0280095, 0.000205366, 0.185219, 0.786566], 
              [0.0095076, 0.99003, 0.000205366, 0.000257169], 
              [0.000257169, 0.99928, 0.000205366, 0.000257169], 
              [0.0095076, 0.980778, 0.0094558, 0.000257169], 
              [0.157519, 0.740261, 0.0464585, 0.0557618], 
              [0.832819, 0.05571, 0.05571, 0.0557618], 
              [0.0835131, 0.712509, 0.0834613, 0.120516]
            ]
          }, {
            "db": 0,
            "id": "MA1291.1",
            "alt": "TCP7",
            "len": 11,
            "nsites": 588,
            "url": "http://jaspar.genereg.net/matrix/MA1291.1",
            "pwm": [
              [0.00174798, 3.77487e-05, 0.998167, 4.72708e-05], 
              [4.72708e-05, 0.0255434, 3.77487e-05, 0.974372], 
              [0.115674, 3.77487e-05, 0.884241, 4.72708e-05], 
              [4.72708e-05, 3.77487e-05, 0.999868, 4.72708e-05], 
              [0.00684911, 0.00173846, 0.991366, 4.72708e-05], 
              [0.387736, 0.156474, 0.275501, 0.180289], 
              [0.0374559, 0.874039, 3.77487e-05, 0.0884672], 
              [0.00344769, 0.996467, 3.77487e-05, 4.72708e-05], 
              [0.042557, 0.945455, 0.00683959, 0.0051484], 
              [0.766924, 0.0510491, 0.127567, 0.05446], 
              [0.0714641, 0.545863, 0.112264, 0.270409]
            ]
          }, {
            "db": 0,
            "id": "MA1363.1",
            "alt": "bHLH69",
            "len": 15,
            "nsites": 34,
            "url": "http://jaspar.genereg.net/matrix/MA1363.1",
            "pwm": [
              [0.030141, 0.79244, 0.147279, 0.030141], 
              [0.176769, 0.0299768, 0.675138, 0.118117], 
              [0.0887915, 0.0593025, 0.147279, 0.704627], 
              [0.147443, 0.0299768, 0.733789, 0.0887915], 
              [0.176769, 0.264581, 0.235255, 0.323395], 
              [0.000815249, 0.147279, 0.381883, 0.470023], 
              [0.264745, 0.205929, 0.0593025, 0.470023], 
              [0.000815249, 0.293907, 0.381883, 0.323395], 
              [0.118117, 0.235255, 0.52851, 0.118117], 
              [0.000815249, 0.997718, 0.000651027, 0.000815249], 
              [0.997883, 0.000651027, 0.000651027, 0.000815249], 
              [0.000815249, 0.997718, 0.000651027, 0.000815249], 
              [0.030141, 0.000651027, 0.968393, 0.000815249], 
              [0.000815249, 0.000651027, 0.000651027, 0.997883], 
              [0.000815249, 0.0299768, 0.968393, 0.000815249]
            ]
          }, {
            "db": 0,
            "id": "MA1364.1",
            "alt": "PIF7",
            "len": 15,
            "nsites": 112,
            "url": "http://jaspar.genereg.net/matrix/MA1364.1",
            "pwm": [
              [0.0983744, 0.294578, 0.481911, 0.125136], 
              [0.250025, 0.17861, 0.196452, 0.374913], 
              [0.16974, 0.0804834, 0.455149, 0.294628], 
              [0.410596, 0.0715633, 0.348101, 0.16974], 
              [0.374913, 0.125087, 0.285657, 0.214343], 
              [0.250025, 0.0715633, 0.196452, 0.481961], 
              [0.0359301, 0.258896, 0.588958, 0.116215], 
              [0.0359301, 0.75845, 0.0358802, 0.16974], 
              [0.000247993, 0.999306, 0.000198038, 0.000247993], 
              [0.999356, 0.000198038, 0.000198038, 0.000247993], 
              [0.000247993, 0.945783, 0.000198038, 0.0537712], 
              [0.000247993, 0.000198038, 0.999306, 0.000247993], 
              [0.000247993, 0.000198038, 0.000198038, 0.999356], 
              [0.000247993, 0.000198038, 0.981465, 0.0180891], 
              [0.0448512, 0.214293, 0.580037, 0.160819]
            ]
          }, {
            "db": 0,
            "id": "MA1410.1",
            "alt": "StBRC1",
            "len": 10,
            "nsites": 100001,
            "url": "http://jaspar.genereg.net/matrix/MA1410.1",
            "pwm": [
              [0.114979, 0.236828, 0.365976, 0.282217], 
              [0.0243703, 0.0208202, 0.930149, 0.0246603], 
              [0.00419027, 0.00447022, 0.984999, 0.00634027], 
              [0.0440202, 0.14768, 0.750889, 0.0574102], 
              [0.0460202, 0.5971, 0.31742, 0.0394602], 
              [0.00925027, 0.976599, 0.00962021, 0.00453027], 
              [0.0657092, 0.91693, 0.0103102, 0.00705027], 
              [0.30634, 0.5283, 0.11378, 0.0515802], 
              [0.165898, 0.520865, 0.0976491, 0.215588], 
              [0.14072, 0.48745, 0.17972, 0.19211]
            ]
          }, {
            "db": 0,
            "id": "MA1428.1",
            "alt": "TCP8",
            "len": 9,
            "nsites": 998,
            "url": "http://jaspar.genereg.net/matrix/MA1428.1",
            "pwm": [
              [0.172356, 0.240479, 0.373732, 0.213433], 
              [0.0411467, 0.0150657, 0.803352, 0.140435], 
              [0.1433, 0.0290773, 0.726402, 0.10122], 
              [0.150163, 0.255252, 0.433412, 0.161173], 
              [0.160493, 0.653919, 0.0632059, 0.122383], 
              [0.0321206, 0.965823, 0.00202804, 2.78529e-05], 
              [0.0200658, 0.90374, 2.22423e-05, 0.0761722], 
              [0.865672, 0.00102414, 0.113237, 0.0200658], 
              [0.0320566, 0.725676, 0.0971095, 0.145158]
            ]
          }, {
            "db": 0,
            "id": "MA1430.1",
            "alt": "TB1",
            "len": 10,
            "nsites": 999,
            "url": "http://jaspar.genereg.net/matrix/MA1430.1",
            "pwm": [
              [2.7825e-05, 2.222e-05, 0.999922, 2.7825e-05], 
              [2.7825e-05, 2.222e-05, 0.999922, 2.7825e-05], 
              [0.0841874, 0.308608, 0.519008, 0.088195], 
              [2.7825e-05, 0.999922, 2.222e-05, 2.7825e-05], 
              [2.7825e-05, 0.999922, 2.222e-05, 2.7825e-05], 
              [0.0410647, 0.958885, 2.222e-05, 2.7825e-05], 
              [0.0371351, 0.955795, 2.222e-05, 0.00704812], 
              [0.153165, 0.839778, 0.00402582, 0.00303052], 
              [0.143156, 0.648606, 0.0130339, 0.195203], 
              [0.385761, 0.405794, 0.119248, 0.0891969]
            ]
          }, {
            "db": 0,
            "id": "MA1431.1",
            "alt": "rst2",
            "len": 10,
            "nsites": 998,
            "url": "http://jaspar.genereg.net/matrix/MA1431.1",
            "pwm": [
              [0.256515, 0.163333, 0.19339, 0.386763], 
              [0.392166, 0.188569, 0.204616, 0.21465], 
              [0.0220696, 0.938806, 0.0130469, 0.0260772], 
              [0.00703415, 0.880815, 0.00402584, 0.108125], 
              [2.78529e-05, 0.996919, 0.00202404, 0.00102875], 
              [0.00603925, 0.991907, 2.22423e-05, 0.00203165], 
              [0.208424, 0.0400982, 0.530029, 0.221449], 
              [0.0561342, 0.897728, 0.00202604, 0.0441114], 
              [0.382756, 0.216434, 0.131272, 0.26954], 
              [0.165342, 0.379744, 0.141291, 0.313623]
            ]
          }, {
            "db": 0,
            "id": "MA1432.1",
            "alt": "cre-1",
            "len": 8,
            "nsites": 998,
            "url": "http://jaspar.genereg.net/matrix/MA1432.1",
            "pwm": [
              [0.00804305, 0.986897, 2.22423e-05, 0.00503735], 
              [2.78529e-05, 0.759465, 2.22423e-05, 0.240485], 
              [0.0650863, 0.872808, 0.0390573, 0.0230485], 
              [2.78529e-05, 0.999922, 2.22423e-05, 2.78529e-05], 
              [0.499477, 2.22423e-05, 0.489462, 0.0110377], 
              [0.139432, 0.377115, 0.252755, 0.230697], 
              [0.284568, 0.23046, 0.244487, 0.240485], 
              [0.280843, 0.298889, 0.261781, 0.158487]
            ]
          }, {
            "db": 0,
            "id": "MA1491.1",
            "alt": "GLI3",
            "len": 15,
            "nsites": 27502,
            "url": "http://jaspar.genereg.net/matrix/MA1491.1",
            "pwm": [
              [0.336885, 0.287725, 0.280052, 0.0953397], 
              [0.00864098, 0.0113258, 0.915451, 0.0645818], 
              [0.718193, 0.164438, 0.117243, 0.00012501], 
              [0.003517, 0.996119, 0.000362806, 1.01083e-06], 
              [0.00036301, 0.999583, 5.2807e-05, 1.01083e-06], 
              [0.854188, 0.103861, 0.00911377, 0.0328359], 
              [0.00015601, 0.999583, 0.000207806, 5.30106e-05], 
              [0.216029, 0.783839, 4.38071e-05, 8.80105e-05], 
              [0.0267419, 0.956138, 0.000760804, 0.01636], 
              [0.926415, 8.07212e-07, 0.0735835, 1.01083e-06], 
              [0.0951307, 0.780145, 0.0591846, 0.0655388], 
              [0.190302, 0.222108, 0.521394, 0.0661948], 
              [0.321687, 0.127418, 0.203961, 0.346933], 
              [0.242454, 0.423454, 0.0880605, 0.246031], 
              [0.0415619, 0.114479, 0.768467, 0.0754917]
            ]
          }, {
            "db": 0,
            "id": "MA1512.1",
            "alt": "KLF11",
            "len": 11,
            "nsites": 9165,
            "url": "http://jaspar.genereg.net/matrix/MA1512.1",
            "pwm": [
              [0.205347, 0.224113, 0.428803, 0.141736], 
              [0.220647, 0.605518, 0.0437599, 0.130076], 
              [0.0651713, 0.868451, 0.0156433, 0.0507345], 
              [0.858114, 0.127802, 0.0114043, 0.00268], 
              [3.03324e-06, 0.995853, 2.42223e-06, 0.00414199], 
              [0.218206, 0.00467937, 0.745722, 0.0313937], 
              [0.00119702, 0.994348, 0.0019564, 0.00249901], 
              [0.000112032, 0.996947, 0.0021774, 0.000764025], 
              [3.03324e-06, 0.909555, 0.000409418, 0.0900331], 
              [0.481168, 0.433656, 0.00708334, 0.0780932], 
              [0.0546954, 0.791013, 0.0337021, 0.120589]
            ]
          }, {
            "db": 0,
            "id": "MA1513.1",
            "alt": "KLF15",
            "len": 11,
            "nsites": 11369,
            "url": "http://jaspar.genereg.net/matrix/MA1513.1",
            "pwm": [
              [0.104145, 0.255343, 0.487112, 0.153401], 
              [0.0824187, 0.572255, 0.186208, 0.159118], 
              [0.00352041, 0.988119, 0.00756589, 0.000794438], 
              [0.00818237, 0.962259, 0.0292917, 0.000266443], 
              [2.44522e-06, 0.999905, 8.99519e-05, 2.44522e-06], 
              [2.44522e-06, 1.95266e-06, 0.999993, 2.44522e-06], 
              [0.000970437, 0.997882, 0.000177951, 0.000970437], 
              [0.0048404, 0.96349, 0.0315787, 9.04444e-05], 
              [0.00105844, 0.989878, 0.00879788, 0.000266443], 
              [0.137744, 0.551233, 0.170112, 0.14091], 
              [0.0938536, 0.440934, 0.274782, 0.190431]
            ]
          }, {
            "db": 0,
            "id": "MA1527.1",
            "alt": "NFIC(var.2)",
            "len": 17,
            "nsites": 2118,
            "url": "http://jaspar.genereg.net/matrix/MA1527.1",
            "pwm": [
              [0.187917, 0.264398, 0.359295, 0.188389], 
              [0.0563155, 0.207688, 0.0219244, 0.714072], 
              [1.3125e-05, 1.04811e-05, 0.00236537, 0.997611], 
              [1.3125e-05, 1.04811e-05, 0.999963, 1.3125e-05], 
              [1.3125e-05, 0.00142441, 0.998549, 1.3125e-05], 
              [0.045097, 0.954879, 1.04811e-05, 1.3125e-05], 
              [0.328455, 0.12648, 0.327508, 0.217558], 
              [0.183755, 0.333013, 0.232404, 0.250828], 
              [0.209163, 0.273841, 0.320108, 0.196888], 
              [0.224743, 0.180361, 0.415949, 0.178947], 
              [0.0736136, 0.123283, 0.0351788, 0.767925], 
              [1.3125e-05, 1.04811e-05, 0.999963, 1.3125e-05], 
              [1.3125e-05, 0.993864, 0.00611019, 1.3125e-05], 
              [0.00142706, 0.998549, 1.04811e-05, 1.3125e-05], 
              [0.999966, 1.04811e-05, 1.04811e-05, 1.3125e-05], 
              [0.47402, 0.00830309, 0.450447, 0.06723], 
              [0.171865, 0.328135, 0.305473, 0.194527]
            ]
          }, {
            "db": 0,
            "id": "MA1528.1",
            "alt": "NFIX(var.2)",
            "len": 17,
            "nsites": 17347,
            "url": "http://jaspar.genereg.net/matrix/MA1528.1",
            "pwm": [
              [0.183433, 0.247132, 0.382774, 0.186662], 
              [0.155218, 0.134042, 0.116396, 0.594344], 
              [0.00632357, 0.0114992, 0.118767, 0.863412], 
              [1.60257e-06, 1.27975e-06, 0.999996, 1.60257e-06], 
              [1.60257e-06, 1.27975e-06, 0.999996, 1.60257e-06], 
              [0.0940551, 0.896894, 1.27975e-06, 0.00905055], 
              [0.409546, 0.10896, 0.293439, 0.188056], 
              [0.180158, 0.341288, 0.221723, 0.256832], 
              [0.176468, 0.274934, 0.345381, 0.203217], 
              [0.197325, 0.145789, 0.45783, 0.199055], 
              [0.0776212, 0.100693, 0.0622989, 0.759388], 
              [1.60257e-06, 1.27975e-06, 0.974217, 0.0257805], 
              [1.60257e-06, 0.999996, 1.27975e-06, 1.60257e-06], 
              [1.60257e-06, 0.999996, 1.27975e-06, 1.60257e-06], 
              [0.885945, 0.0947957, 0.00321926, 0.0160395], 
              [0.364822, 0.0948197, 0.394866, 0.145492], 
              [0.164775, 0.305794, 0.33093, 0.198501]
            ]
          }, {
            "db": 0,
            "id": "MA1548.1",
            "alt": "PLAGL2",
            "len": 10,
            "nsites": 999,
            "url": "http://jaspar.genereg.net/matrix/MA1548.1",
            "pwm": [
              [0.224229, 0.224224, 0.224224, 0.327322], 
              [0.0391019, 0.0390963, 0.81457, 0.107231], 
              [2.7825e-05, 2.222e-05, 0.999922, 2.7825e-05], 
              [2.7825e-05, 0.151158, 0.848786, 2.7825e-05], 
              [2.7825e-05, 0.799742, 0.200202, 2.7825e-05], 
              [2.7825e-05, 0.999922, 2.222e-05, 2.7825e-05], 
              [2.7825e-05, 0.999922, 2.222e-05, 2.7825e-05], 
              [2.7825e-05, 0.925856, 2.222e-05, 0.0740944], 
              [0.0902898, 0.686012, 0.0250947, 0.198604], 
              [0.210217, 0.210211, 0.210211, 0.36936]
            ]
          }, {
            "db": 0,
            "id": "MA1564.1",
            "alt": "SP9",
            "len": 12,
            "nsites": 2452,
            "url": "http://jaspar.genereg.net/matrix/MA1564.1",
            "pwm": [
              [0.340128, 0.179447, 0.388247, 0.0921776], 
              [0.147247, 0.6376, 0.0803908, 0.134761], 
              [0.101301, 0.773408, 0.0356656, 0.0896257], 
              [0.65709, 0.302142, 0.0150214, 0.0257473], 
              [0.000818304, 0.988674, 0.00686677, 0.00364119], 
              [0.0695305, 0.0659044, 0.807554, 0.057011], 
              [0.00885698, 0.985494, 9.05347e-06, 0.00564011], 
              [1.13372e-05, 0.987877, 9.05347e-06, 0.0121028], 
              [0.0133398, 0.837637, 0.00821072, 0.140813], 
              [0.419417, 0.442989, 0.0133795, 0.124214], 
              [0.0664396, 0.658286, 0.0674973, 0.207777], 
              [0.171363, 0.476122, 0.0832367, 0.269278]
            ]
          }, {
            "db": 0,
            "id": "MA1650.1",
            "alt": "ZBTB14",
            "len": 12,
            "nsites": 4547,
            "url": "http://jaspar.genereg.net/matrix/MA1650.1",
            "pwm": [
              [0.12536, 0.391243, 0.366832, 0.116564], 
              [0.110187, 0.433688, 0.341981, 0.114145], 
              [0.0736795, 0.775224, 0.135036, 0.0160608], 
              [0.00902292, 0.943903, 0.0340921, 0.0129818], 
              [0.0204587, 0.0646615, 0.901239, 0.0136408], 
              [0.0149608, 0.89684, 0.0701593, 0.0180397], 
              [0.0290355, 0.0670804, 0.889143, 0.0147408], 
              [0.0123218, 0.918833, 0.0574036, 0.0114419], 
              [0.989648, 0.0081417, 0.00220383, 6.11378e-06], 
              [0.0217786, 0.807992, 0.143173, 0.0270565], 
              [0.213328, 0.355836, 0.31911, 0.111726], 
              [0.097211, 0.497025, 0.272486, 0.133278]
            ]
          }, {
            "db": 0,
            "id": "MA1696.1",
            "alt": "ARF39",
            "len": 12,
            "nsites": 4068,
            "url": "http://jaspar.genereg.net/matrix/MA1696.1",
            "pwm": [
              [0.132502, 0.49311, 0.157573, 0.216816], 
              [0.176993, 0.141595, 0.583324, 0.0980874], 
              [0.126356, 0.00787126, 0.859374, 0.00639768], 
              [0.0113146, 0.00664229, 0.979086, 0.00295676], 
              [0.074243, 0.0113132, 0.88789, 0.0265552], 
              [0.516464, 0.00713428, 0.463121, 0.0132805], 
              [0.942216, 0.00713428, 0.0422854, 0.00836463], 
              [0.0142645, 0.965075, 0.0152461, 0.0054147], 
              [0.94787, 0.0260618, 0.016967, 0.00910161], 
              [0.169128, 0.450338, 0.171338, 0.209196], 
              [0.114557, 0.253195, 0.555056, 0.0771929], 
              [0.154624, 0.127091, 0.164455, 0.553828]
            ]
          }
        ],
        "all_matches": [
          {
            "idx": 1,
            "matches": [
              {
                "idx": 35,
                "rc": false,
                "off": -6,
                "pv": "1.02e-07",
                "ev": "1.68e-04",
                "qv": "3.31e-04"
              }, {
                "idx": 32,
                "rc": false,
                "off": -4,
                "pv": "3.69e-07",
                "ev": "6.07e-04",
                "qv": "4.09e-04"
              }, {
                "idx": 54,
                "rc": false,
                "off": -5,
                "pv": "3.79e-07",
                "ev": "6.24e-04",
                "qv": "4.09e-04"
              }, {
                "idx": 49,
                "rc": true,
                "off": -3,
                "pv": "5.33e-07",
                "ev": "8.77e-04",
                "qv": "4.09e-04"
              }, {
                "idx": 26,
                "rc": false,
                "off": -5,
                "pv": "6.74e-07",
                "ev": "1.11e-03",
                "qv": "4.09e-04"
              }, {
                "idx": 50,
                "rc": false,
                "off": -3,
                "pv": "7.57e-07",
                "ev": "1.25e-03",
                "qv": "4.09e-04"
              }, {
                "idx": 29,
                "rc": false,
                "off": -6,
                "pv": "1.19e-06",
                "ev": "1.96e-03",
                "qv": "5.52e-04"
              }, {
                "idx": 39,
                "rc": false,
                "off": -6,
                "pv": "4.49e-06",
                "ev": "7.39e-03",
                "qv": "1.82e-03"
              }, {
                "idx": 47,
                "rc": true,
                "off": -3,
                "pv": "5.68e-06",
                "ev": "9.34e-03",
                "qv": "1.88e-03"
              }, {
                "idx": 30,
                "rc": false,
                "off": -4,
                "pv": "5.79e-06",
                "ev": "9.53e-03",
                "qv": "1.88e-03"
              }, {
                "idx": 45,
                "rc": false,
                "off": -3,
                "pv": "8.28e-06",
                "ev": "1.36e-02",
                "qv": "2.24e-03"
              }, {
                "idx": 42,
                "rc": false,
                "off": 6,
                "pv": "1.07e-05",
                "ev": "1.77e-02",
                "qv": "2.49e-03"
              }, {
                "idx": 53,
                "rc": false,
                "off": -5,
                "pv": "1.71e-05",
                "ev": "2.82e-02",
                "qv": "3.70e-03"
              }, {
                "idx": 41,
                "rc": false,
                "off": -3,
                "pv": "2.48e-05",
                "ev": "4.08e-02",
                "qv": "4.50e-03"
              }, {
                "idx": 37,
                "rc": false,
                "off": -6,
                "pv": "2.50e-05",
                "ev": "4.11e-02",
                "qv": "4.50e-03"
              }, {
                "idx": 40,
                "rc": false,
                "off": -6,
                "pv": "2.50e-05",
                "ev": "4.11e-02",
                "qv": "4.50e-03"
              }, {
                "idx": 46,
                "rc": true,
                "off": -1,
                "pv": "3.43e-05",
                "ev": "5.64e-02",
                "qv": "5.85e-03"
              }, {
                "idx": 28,
                "rc": false,
                "off": -6,
                "pv": "4.59e-05",
                "ev": "7.55e-02",
                "qv": "7.09e-03"
              }, {
                "idx": 38,
                "rc": false,
                "off": -6,
                "pv": "8.01e-05",
                "ev": "1.32e-01",
                "qv": "1.13e-02"
              }, {
                "idx": 36,
                "rc": false,
                "off": -6,
                "pv": "8.93e-05",
                "ev": "1.47e-01",
                "qv": "1.18e-02"
              }, {
                "idx": 48,
                "rc": false,
                "off": -3,
                "pv": "9.09e-05",
                "ev": "1.50e-01",
                "qv": "1.18e-02"
              }, {
                "idx": 57,
                "rc": true,
                "off": -1,
                "pv": "9.93e-05",
                "ev": "1.63e-01",
                "qv": "1.24e-02"
              }, {
                "idx": 5,
                "rc": true,
                "off": -2,
                "pv": "1.08e-04",
                "ev": "1.78e-01",
                "qv": "1.24e-02"
              }, {
                "idx": 44,
                "rc": false,
                "off": 6,
                "pv": "1.16e-04",
                "ev": "1.90e-01",
                "qv": "1.24e-02"
              }, {
                "idx": 4,
                "rc": true,
                "off": -2,
                "pv": "1.55e-04",
                "ev": "2.56e-01",
                "qv": "1.57e-02"
              }, {
                "idx": 27,
                "rc": false,
                "off": -4,
                "pv": "2.21e-04",
                "ev": "3.64e-01",
                "qv": "1.99e-02"
              }, {
                "idx": 55,
                "rc": true,
                "off": -2,
                "pv": "3.51e-04",
                "ev": "5.78e-01",
                "qv": "3.08e-02"
              }, {
                "idx": 43,
                "rc": false,
                "off": -2,
                "pv": "3.73e-04",
                "ev": "6.13e-01",
                "qv": "3.18e-02"
              }, {
                "idx": 34,
                "rc": true,
                "off": 1,
                "pv": "4.27e-04",
                "ev": "7.03e-01",
                "qv": "3.55e-02"
              }, {
                "idx": 22,
                "rc": false,
                "off": -6,
                "pv": "5.75e-04",
                "ev": "9.46e-01",
                "qv": "4.66e-02"
              }, {
                "idx": 7,
                "rc": true,
                "off": 4,
                "pv": "6.01e-04",
                "ev": "9.90e-01",
                "qv": "4.68e-02"
              }, {
                "idx": 14,
                "rc": true,
                "off": -4,
                "pv": "1.24e-03",
                "ev": "2.04e+00",
                "qv": "8.58e-02"
              }, {
                "idx": 31,
                "rc": false,
                "off": 1,
                "pv": "1.30e-03",
                "ev": "2.13e+00",
                "qv": "8.63e-02"
              }, {
                "idx": 33,
                "rc": false,
                "off": -4,
                "pv": "1.45e-03",
                "ev": "2.39e+00",
                "qv": "8.63e-02"
              }, {
                "idx": 63,
                "rc": true,
                "off": -3,
                "pv": "1.45e-03",
                "ev": "2.39e+00",
                "qv": "8.63e-02"
              }, {
                "idx": 21,
                "rc": true,
                "off": 3,
                "pv": "3.12e-03",
                "ev": "5.13e+00",
                "qv": "1.66e-01"
              }, {
                "idx": 10,
                "rc": true,
                "off": -2,
                "pv": "3.25e-03",
                "ev": "5.34e+00",
                "qv": "1.70e-01"
              }, {
                "idx": 65,
                "rc": true,
                "off": 1,
                "pv": "3.57e-03",
                "ev": "5.87e+00",
                "qv": "1.84e-01"
              }, {
                "idx": 16,
                "rc": false,
                "off": 0,
                "pv": "5.38e-03",
                "ev": "8.85e+00",
                "qv": "2.69e-01"
              }, {
                "idx": 52,
                "rc": true,
                "off": 1,
                "pv": "5.38e-03",
                "ev": "8.86e+00",
                "qv": "2.69e-01"
              }, {
                "idx": 2,
                "rc": false,
                "off": -3,
                "pv": "5.65e-03",
                "ev": "9.31e+00",
                "qv": "2.78e-01"
              }, {
                "idx": 9,
                "rc": true,
                "off": -1,
                "pv": "6.07e-03",
                "ev": "9.99e+00",
                "qv": "2.94e-01"
              }, {
                "idx": 15,
                "rc": true,
                "off": 0,
                "pv": "6.57e-03",
                "ev": "1.08e+01",
                "qv": "3.09e-01"
              }, {
                "idx": 61,
                "rc": false,
                "off": 3,
                "pv": "6.71e-03",
                "ev": "1.10e+01",
                "qv": "3.11e-01"
              }, {
                "idx": 56,
                "rc": true,
                "off": -1,
                "pv": "7.00e-03",
                "ev": "1.15e+01",
                "qv": "3.18e-01"
              }, {
                "idx": 6,
                "rc": true,
                "off": 0,
                "pv": "7.05e-03",
                "ev": "1.16e+01",
                "qv": "3.18e-01"
              }, {
                "idx": 23,
                "rc": false,
                "off": -6,
                "pv": "7.50e-03",
                "ev": "1.24e+01",
                "qv": "3.34e-01"
              }, {
                "idx": 24,
                "rc": false,
                "off": -2,
                "pv": "7.72e-03",
                "ev": "1.27e+01",
                "qv": "3.39e-01"
              }, {
                "idx": 0,
                "rc": false,
                "off": -4,
                "pv": "7.94e-03",
                "ev": "1.31e+01",
                "qv": "3.43e-01"
              }, {
                "idx": 64,
                "rc": false,
                "off": -3,
                "pv": "8.12e-03",
                "ev": "1.34e+01",
                "qv": "3.47e-01"
              }, {
                "idx": 20,
                "rc": true,
                "off": 3,
                "pv": "9.34e-03",
                "ev": "1.54e+01",
                "qv": "3.91e-01"
              }, {
                "idx": 12,
                "rc": true,
                "off": 0,
                "pv": "9.40e-03",
                "ev": "1.55e+01",
                "qv": "3.91e-01"
              }, {
                "idx": 1,
                "rc": true,
                "off": 2,
                "pv": "9.85e-03",
                "ev": "1.62e+01",
                "qv": "4.04e-01"
              }, {
                "idx": 60,
                "rc": true,
                "off": 1,
                "pv": "9.97e-03",
                "ev": "1.64e+01",
                "qv": "4.04e-01"
              }, {
                "idx": 25,
                "rc": false,
                "off": -3,
                "pv": "1.08e-02",
                "ev": "1.78e+01",
                "qv": "4.32e-01"
              }, {
                "idx": 19,
                "rc": true,
                "off": 4,
                "pv": "1.10e-02",
                "ev": "1.80e+01",
                "qv": "4.32e-01"
              }, {
                "idx": 58,
                "rc": true,
                "off": 3,
                "pv": "1.12e-02",
                "ev": "1.84e+01",
                "qv": "4.32e-01"
              }, {
                "idx": 59,
                "rc": false,
                "off": -3,
                "pv": "1.12e-02",
                "ev": "1.84e+01",
                "qv": "4.32e-01"
              }, {
                "idx": 11,
                "rc": true,
                "off": -2,
                "pv": "1.13e-02",
                "ev": "1.86e+01",
                "qv": "4.32e-01"
              }, {
                "idx": 18,
                "rc": true,
                "off": 3,
                "pv": "1.18e-02",
                "ev": "1.94e+01",
                "qv": "4.39e-01"
              }, {
                "idx": 13,
                "rc": true,
                "off": 0,
                "pv": "1.19e-02",
                "ev": "1.95e+01",
                "qv": "4.39e-01"
              }, {
                "idx": 8,
                "rc": false,
                "off": -2,
                "pv": "1.19e-02",
                "ev": "1.96e+01",
                "qv": "4.39e-01"
              }, {
                "idx": 62,
                "rc": false,
                "off": 3,
                "pv": "1.24e-02",
                "ev": "2.04e+01",
                "qv": "4.52e-01"
              }, {
                "idx": 66,
                "rc": false,
                "off": -4,
                "pv": "1.36e-02",
                "ev": "2.23e+01",
                "qv": "4.84e-01"
              }, {
                "idx": 17,
                "rc": false,
                "off": -6,
                "pv": "1.36e-02",
                "ev": "2.23e+01",
                "qv": "4.84e-01"
              }, {
                "idx": 3,
                "rc": false,
                "off": 0,
                "pv": "1.38e-02",
                "ev": "2.26e+01",
                "qv": "4.85e-01"
              }, {
                "idx": 51,
                "rc": false,
                "off": 0,
                "pv": "1.44e-02",
                "ev": "2.37e+01",
                "qv": "4.96e-01"
              }
            ]
          }
        ],
        "runtime": {
          "host": "192.168.2.3",
          "when": "Thu Mar 31 20:26:18 2022",
          "cycles": 10778183,
          "seconds": 10.778
        }
      };
    </script>
    <script>
var site_url = "http://meme-suite.org";
</script>
    <script>
/*
 * $
 *
 * Shorthand function for getElementById
 */
function $(el) {
  return document.getElementById(el);
}


/*
 * See http://stackoverflow.com/a/5450113/66387
 * Does string multiplication like the perl x operator.
 */
function string_mult(pattern, count) {
    if (count < 1) return '';
    var result = '';
    while (count > 1) {
        if (count & 1) result += pattern;
        count >>= 1, pattern += pattern;
    }
    return result + pattern;
}

/*
 * See http://stackoverflow.com/questions/814613/how-to-read-get-data-from-a-url-using-javascript
 * Slightly modified with information from
 * https://developer.mozilla.org/en/DOM/window.location
 */
function parse_params() {
  "use strict";
  var search, queryStart, queryEnd, query, params, nvPairs, i, nv, n, v;
  search = window.location.search;
  queryStart = search.indexOf("?") + 1;
  queryEnd   = search.indexOf("#") + 1 || search.length + 1;
  query      = search.slice(queryStart, queryEnd - 1);

  if (query === search || query === "") return {};

  params  = {};
  nvPairs = query.replace(/\+/g, " ").split("&");

  for (i = 0; i < nvPairs.length; i++) {
    nv = nvPairs[i].split("=");
    n  = decodeURIComponent(nv[0]);
    v  = decodeURIComponent(nv[1]);
    // allow a name to be used multiple times
    // storing each value in the array
    if (!(n in params)) {
      params[n] = [];
    }
    params[n].push(nv.length === 2 ? v : null);
  }
  return params;
}

/*
 * coords
 *
 * Calculates the x and y offset of an element.
 * From http://www.quirksmode.org/js/findpos.html
 * with alterations to take into account scrolling regions
 */
function coords(elem) {
  var myX = myY = 0;
  if (elem.getBoundingClientRect) {
    var rect;
    rect = elem.getBoundingClientRect();
    myX = rect.left + ((typeof window.pageXOffset !== "undefined") ?
        window.pageXOffset : document.body.scrollLeft);
    myY = rect.top + ((typeof window.pageYOffset !== "undefined") ?
        window.pageYOffset : document.body.scrollTop);
  } else {
    // this fall back doesn't properly handle absolutely positioned elements
    // inside a scrollable box
    var node;
    if (elem.offsetParent) {
      // subtract all scrolling
      node = elem;
      do {
        myX -= node.scrollLeft ? node.scrollLeft : 0;
        myY -= node.scrollTop ? node.scrollTop : 0;
      } while (node = node.parentNode);
      // this will include the page scrolling (which is unwanted) so add it back on
      myX += (typeof window.pageXOffset !== "undefined") ? window.pageXOffset : document.body.scrollLeft;
      myY += (typeof window.pageYOffset !== "undefined") ? window.pageYOffset : document.body.scrollTop;
      // sum up offsets
      node = elem;
      do {
        myX += node.offsetLeft;
        myY += node.offsetTop;
      } while (node = node.offsetParent);
    }
  }
  return [myX, myY];
}

/*
 * position_popup
 *
 * Positions a popup relative to an anchor element.
 *
 * The available positions are:
 * 0 - Centered below the anchor.
 */
function position_popup(anchor, popup, position) {
  "use strict";
  var a_x, a_y, a_w, a_h, p_x, p_y, p_w, p_h;
  var a_xy, spacer, margin, scrollbar, page_w;
  // define constants
  spacer = 5;
  margin = 15;
  scrollbar = 15;
  // define the positions and widths
  a_xy = coords(anchor);
  a_x = a_xy[0];
  a_y = a_xy[1];
  a_w = anchor.offsetWidth;
  a_h = anchor.offsetHeight;
  p_w = popup.offsetWidth;
  p_h = popup.offsetHeight;
  page_w = null;
  if (window.innerWidth) {
    page_w = window.innerWidth;
  } else if (document.body) {
    page_w = document.body.clientWidth;
  }
  // check the position type is defined
  if (typeof position !== "number") {
    position = 0;
  }
  // calculate the popup position
  switch (position) {
    case 1:
      p_x = a_x + a_w + spacer;
      p_y = a_y + (a_h / 2) - (p_h / 2);
      break;
    case 0:
    default:
      p_x = a_x + (a_w / 2) - (p_w / 2);
      p_y = a_y + a_h + spacer;
      break;
  }
  // constrain the popup position
  if (p_x < margin) {
    p_x = margin;
  } else if (page_w != null && (p_x + p_w) > (page_w - margin - scrollbar)) {
    p_x = page_w - margin - scrollbar - p_w;
  }
  if (p_y < margin) {
    p_y = margin;
  }
  // position the popup
  popup.style.left = p_x + "px";
  popup.style.top = p_y + "px";
}

function lookup_help_popup(popup_id) {
  var _body, pop, info;
  pop = document.getElementById(popup_id);
  if (pop == null) {
    _body = document.getElementsByTagName("body")[0];
    pop = document.createElement("div");
    pop.className = "pop_content";
    pop.id = popup_id;
    pop.style.backgroundColor = "#FFC";
    pop.style.borderColor = "black";
    info = document.createElement("p");
    info.style.fontWeight = "bold";
    info.appendChild(document.createTextNode("Error: No popup for topic \"" + popup_id + "\"."));
    pop.appendChild(info);
    // this might cause problems with the menu, but as this only happens
    // when something is already wrong I don't think that's too much of a problem
    _body.insertBefore(pop, _body.firstChild);
  }
  if (document.getElementsByTagName('body')[0].hasAttribute("data-autobtns")) {
    if (!/\bauto_buttons\b/.test(pop.className)) {
      pop.className += " auto_buttons";
      var back_btn_sec = document.createElement("div");
      back_btn_sec.className = "nested_only pop_back_sec";
      var back_btn = document.createElement("span");
      back_btn.className = "pop_back";
      back_btn.appendChild(document.createTextNode("<< back"));
      back_btn.addEventListener("click", function(e) {
        help_return();
      }, false);
      back_btn_sec.appendChild(back_btn);
      pop.insertBefore(back_btn_sec, pop.firstChild);
      var close_btn_sec = document.createElement("div");
      close_btn_sec.className = "pop_close_sec";
      var close_btn = document.createElement("span");
      close_btn.className = "pop_close";
      close_btn.appendChild(document.createTextNode("close"));
      close_btn.addEventListener("click", function(e) {
        help_popup();
      }, false);
      close_btn_sec.appendChild(close_btn);
      pop.appendChild(close_btn_sec);
    }
  }
  return pop;
}

/*
 * help_popup
 *
 * Moves around help pop-ups so they appear
 * below an activator.
 */
function help_popup(activator, popup_id) {
  "use strict";
  var pop;
  // set default values
  if (typeof help_popup.popup === "undefined") {
    help_popup.popup = [];
  }
  if (typeof help_popup.activator === "undefined") {
    help_popup.activator = null;
  }
  var last_pop = (help_popup.popup.length > 0 ? help_popup.popup[help_popup.popup.length - 1] : null);
  if (typeof(activator) == "undefined") { // no activator so hide
    if (last_pop != null) {
      last_pop.style.display = 'none';
      help_popup.popup = [];
    }
    return;
  }
  pop = lookup_help_popup(popup_id);
  if (pop == last_pop) {
    if (activator == help_popup.activator) {
      //hide popup (as we've already shown it for the current help button)
      last_pop.style.display = 'none';
      help_popup.popup = [];
      return; // toggling complete!
    }
  } else if (last_pop != null) {
    //activating different popup so hide current one
    last_pop.style.display = 'none';
  }
  help_popup.popup = [pop];
  help_popup.activator = activator;
  toggle_class(pop, "nested", false);
  //must make the popup visible to measure it or it has zero width
  pop.style.display = 'block';
  position_popup(activator, pop);
}

/*
 * help_refine
 * 
 * Intended for links within a help popup. Stores a stack of state so
 * you can go back.
 */
function help_refine(popup_id) {
  if (help_popup.popup == null || help_popup.popup.length == 0 || help_popup.activator == null) {
    //throw new Error("Cannot refine a help popup when one is not shown!");
    var pop = lookup_help_popup(popup_id);
    var act_id = popup_id + '_act';
    var activator = document.getElementById(act_id);
    help_popup(activator, popup_id);
  }
  var pop = lookup_help_popup(popup_id);
  var last_pop = help_popup.popup[help_popup.popup.length - 1];
  if (pop == last_pop) return; // slightly odd, but no real cause for alarm
  help_popup.popup.push(pop);
  toggle_class(pop, "nested", true);
  last_pop.style.display = "none";
  //must make the popup visible to measure it or it has zero width
  pop.style.display = "block";
  position_popup(help_popup.activator, pop);
}

/*
 * help_return
 * 
 * Intended for links within a help popup. Stores a stack of state so
 * you can go back.
 */
function help_return() {
  if (help_popup.popup == null || help_popup.popup.length == 0 || help_popup.activator == null) {
    throw new Error("Can not return to a earlier help popup when one is not shown!");
  }
  var last_pop = help_popup.popup.pop();
  last_pop.style.display = "none";
  var pop = (help_popup.popup.length > 0 ? help_popup.popup[help_popup.popup.length - 1] : null);
  if (pop != null) {
    toggle_class(pop, "nested", help_popup.popup.length > 1);
    pop.style.display = "block";
    position_popup(help_popup.activator, pop);
  } else {
    help_popup.activator = null;
  }
}

/*
 * update_scroll_pad
 *
 * Creates padding at the bottom of the page to allow
 * scrolling of anything into view.
 */
function update_scroll_pad() {
  var page, pad;
  page = (document.compatMode === "CSS1Compat") ? document.documentElement : document.body;
  pad = $("scrollpad");
  if (pad === null) {
    pad = document.createElement("div");
    pad.id = 'scrollpad';
    document.getElementsByTagName('body')[0].appendChild(pad);
  }
  pad.style.height = Math.abs(page.clientHeight - 100) + "px";
}

function substitute_classes(node, remove, add) {
  "use strict";
  var list, all, i, cls, classes;
  list = node.className.split(/\s+/);
  all = {};
  for (i = 0; i < list.length; i++) {
    if (list[i].length > 0) all[list[i]] = true;
  }
  for (i = 0; i < remove.length; i++) {
    if (all.hasOwnProperty(remove[i])) {
      delete all[remove[i]];
    }
  }
  for (i = 0; i < add.length; i++) {
    all[add[i]] = true;
  }
  classes = "";
  for (cls in all) {
    classes += cls + " ";
  }
  node.className = classes;
}

/*
 * toggle_class
 *
 * Adds or removes a class from the node. If the parameter 'enabled' is not 
 * passed then the existence of the class will be toggled, otherwise it will be
 * included if enabled is true.
 */
function toggle_class(node, cls, enabled) {
  var classes = node.className;
  var list = classes.replace(/^\s+/, '').replace(/\s+$/, '').split(/\s+/);
  var found = false;
  for (var i = 0; i < list.length; i++) {
    if (list[i] == cls) {
      list.splice(i, 1);
      i--;
      found = true;
    }
  }
  if (typeof enabled == "undefined") {
    if (!found) list.push(cls);
  } else {
    if (enabled) list.push(cls);
  }
  node.className = list.join(" ");
}

/*
 * find_child
 *
 * Searches child nodes in depth first order and returns the first it finds
 * with the className specified.
 * TODO replace with querySelector
 */
function find_child(node, className) {
  var pattern;
  if (node == null || typeof node !== "object") {
    return null;
  }
  if (typeof className === "string") {
    pattern = new RegExp("\\b" + className + "\\b");
  } else {
    pattern = className;
  }
  if (node.nodeType == Node.ELEMENT_NODE && 
      pattern.test(node.className)) {
    return node;
  } else {
    var result = null;
    for (var i = 0; i < node.childNodes.length; i++) {
      result = find_child(node.childNodes[i], pattern);
      if (result != null) break;
    }
    return result;
  }
}

/*
 * find_parent
 *
 * Searches parent nodes outwards from the node and returns the first it finds
 * with the className specified.
 */
function find_parent(node, className) {
  var pattern;
  pattern = new RegExp("\\b" + className + "\\b");
  do {
    if (node.nodeType == Node.ELEMENT_NODE && 
        pattern.test(node.className)) {
      return node;
    }
  } while (node = node.parentNode);
  return null;
}

/*
 * find_parent_tag
 *
 * Searches parent nodes outwards from the node and returns the first it finds
 * with the tag name specified. HTML tags should be specified in upper case.
 */
function find_parent_tag(node, tag_name) {
  do {
    if (node.nodeType == Node.ELEMENT_NODE && node.tagName == tag_name) {
      return node;
    }
  } while (node = node.parentNode);
  return null;
}

/*
 * __toggle_help
 *
 * Uses the 'topic' property of the this object to
 * toggle display of a help topic.
 *
 * This function is not intended to be called directly.
 */
function __toggle_help(e) {
  if (!e) e = window.event;
  if (e.type === "keydown") {
    if (e.keyCode !== 13 && e.keyCode !== 32) {
      return;
    }
    // stop a submit or something like that
    e.preventDefault();
  }

  help_popup(this, this.getAttribute("data-topic"));
}

function setup_help_button(button) {
  "use strict";
  var topic;
  if (button.hasAttribute("data-topic")) {
    topic = button.getAttribute("data-topic");
    if (document.getElementById(topic) != null) {
      button.tabIndex = "0"; // make keyboard selectable
      button.addEventListener("click", function() {
        help_popup(button, topic);
      }, false);
      button.addEventListener("keydown", function(e) {
        // toggle only on Enter or Spacebar, let other keys do their thing
        if (e.keyCode !== 13 && e.keyCode !== 32) return;
        // stop a submit or something like that
        e.preventDefault();
        help_popup(button, topic);
      }, false);
    } else {
      button.style.visibility = "hidden";
    }
  }
  button.className += " active";
}

/*
 * help_button
 *
 * Makes a help button for the passed topic.
 */
function help_button(topic) {
  var btn = document.createElement("div");
  btn.className = "help";
  btn.setAttribute("data-topic", topic);
  setup_help_button(btn);
  return btn;
}

/*
 * prepare_download
 *
 * Sets the attributes of a link to setup a file download using the given content.
 * If no link is provided then create one and click it.
 */
function prepare_download(content, mimetype, filename, link) {
  "use strict";
  // if no link is provided then create one and click it
  var click_link = false;
  if (!link) {
    link = document.createElement("a");
    click_link = true;
  }
  try {
    // Use a BLOB to convert the text into a data URL.
    // We could do this manually with a base 64 conversion.
    // This will only be supported on modern browsers,
    // hence the try block.
    var blob = new Blob([content], {type: mimetype});
    var reader = new FileReader();
    reader.onloadend = function() {
      // If we're lucky the browser will also support the download
      // attribute which will let us suggest a file name to save the link.
      // Otherwise it is likely that the filename will be unintelligible. 
      link.setAttribute("download", filename);
      link.href = reader.result;
      if (click_link) {
        // must add the link to click it
        document.body.appendChild(link);
        link.click();
        document.body.removeChild(link);
      }
    }
    reader.readAsDataURL(blob);
  } catch (error) {
    if (console && console.log) console.log(error);
    // probably an old browser
    link.href = "";
    link.visible = false;
  }
}

/*
 * add_cell
 *
 * Add a cell to the table row.
 */
function add_cell(row, node, cls, click_action) {
  var cell = row.insertCell(row.cells.length);
  if (node) cell.appendChild(node);
  if (cls && cls !== "") cell.className = cls;
  if (click_action) cell.addEventListener("click", click_action, false);
}

/*
 * add_header_cell
 *
 * Add a header cell to the table row.
 */
function add_header_cell(row, node, help_topic, cls, colspan) {
  var th = document.createElement("th");
  if (node) th.appendChild(node);
  if (help_topic && help_topic !== "") th.appendChild(help_button(help_topic));
  if (cls && cls !== "") th.className = cls;
  if (typeof colspan == "number" && colspan > 1) th.colSpan = colspan;
  row.appendChild(th);
}

/*
 * add_text_cell
 *
 * Add a text cell to the table row.
 */
function add_text_cell(row, text, cls, action) {
  var node = null;
  if (typeof(text) != 'undefined') node = document.createTextNode(text);
  add_cell(row, node, cls, action);
}

/*
 * add_text_header_cell
 *
 * Add a text header cell to the table row.
 */
function add_text_header_cell(row, text, help_topic, cls, action, colspan) {
  var node = null;
  if (typeof(text) != 'undefined') {
    var nbsp = (help_topic ? "\u00A0" : "");
    var str = "" + text;
    var parts = str.split(/\n/);
    if (parts.length === 1) {
      if (action) {
        node = document.createElement("span");
        node.appendChild(document.createTextNode(str + nbsp));
      } else {
        node = document.createTextNode(str + nbsp);
      }
    } else {
      node = document.createElement("span");
      for (var i = 0; i < parts.length; i++) {
        if (i !== 0) {
          node.appendChild(document.createElement("br"));
        }
        node.appendChild(document.createTextNode(parts[i]));
      }
    }
    if (action) {
      node.addEventListener("click", action, false);
      node.style.cursor = "pointer";
    }
  }
  add_header_cell(row, node, help_topic, cls, colspan);
}

function setup_help() {
  "use strict";
  var help_buttons, i;
  help_buttons = document.querySelectorAll(".help:not(.active)");
  for (i = 0; i < help_buttons.length; i++) {
    setup_help_button(help_buttons[i]);
  }
}

function setup_scrollpad() {
  "use strict";
  if (document.getElementsByTagName('body')[0].hasAttribute("data-scrollpad") && document.getElementById("scrollpad") == null) {
    window.addEventListener("resize", update_scroll_pad, false);
    update_scroll_pad();
  }
}

// anon function to avoid polluting global scope
(function() {
  "use strict";
  window.addEventListener("load", function load(evt) {
    window.removeEventListener("load", load, false);
    setup_help();
    setup_scrollpad();
  }, false);
})();

/*
 *  make_link
 *
 *  Creates a text node and if a URL is specified it surrounds it with a link.
 *  If the URL doesn't begin with "http://" it automatically adds it, as
 *  relative links don't make much sense in this context.
 */
function make_link(text, url) {
  var textNode = null;
  var link = null;
  if (typeof text !== "undefined" && text !== null) textNode = document.createTextNode(text);
  if (typeof url === "string") {
    if (url.indexOf("//") == -1) {
      url = "http://" + url;
    }
    link = document.createElement('a');
    link.href = url;
    if (textNode) link.appendChild(textNode);
    return link;
  }
  return textNode;
}

//
// Function to create an HTML paragraph describing the 
// MEME Suite background model source.
//
function make_background_source(title, source, text) {
  var paraNode = document.createElement("P");
  var titleNode = document.createElement("B");
  var textNode1 = document.createTextNode("\u00A0\u00A0\u00A0\u00A0" + title + ": ");
  titleNode.appendChild(textNode1);
  var source_text = ((source == "--motif--") ? "the (first) motif file" : (source == "--nrdb--") ? "an old version of the NCBI non-redundant database" : (source == "--uniform--") ? "the uniform model" : (source == "--query--") ? "the query file" : (source == "--sequences--") ? "built from the (primary) sequences" : ("the file '" + source + "'"));
  if (text) { return source_text; }
  var textNode2 = document.createTextNode(source_text);
  paraNode.appendChild(titleNode);
  paraNode.appendChild(textNode2);
  return paraNode;
}

// Function to create a help button
function make_help_button(container, help_topic) {
  container.appendChild(help_button(help_topic));
}
</script>
    <script>
//
// simple-shared-doc.js
//
// Function to replace the innerHTML of element "id" with the HTML indicated by "doc_type".
// Easier to read and update than the more flexible approach in shared-doc.js. 
//
function print_doc(id, doc_type) {
  var html;
  switch (doc_type) {
    case 'motif-consensus':
      html = `
	<p id="consensus_doc"> 
	   A <b>consensus sequence</b> is constructed from each column in a
	   motif's frequency matrix using the <b>"50% rule"</b>
	   as follows:
	</p>
	<ol>
	  <li>The letter frequencies in the column are sorted in decreasing order.</li>
	  <li>Letters with frequency less 50% of the maximum are discarded.</li>
	  <li>The letter used in this position in the consensus sequence is determined
	  by the first rule below that applies:</li>
	  <ul>
	    <li>If there is only one letter left, or if the remaining letters exactly match
	    an ambiguous symbol in the alphabet, the <b>letter</b> or <b>ambiguous symbol</b>,
	    respectively, is used.</li>
	    <li>Otherwise, if the remaining set contains at least 50% of the core
	    symbols in the alphabet, the alphabet's <b>wildcard</b>
	    (e.g., "N" for DNA or RNA, and "X" for protein) is used.</li>
	    <li>Otherwise, the letter with the <b>maximum frequency</b> is used.</li>
	  </ul>
	</ol>
      `;
      document.getElementById(id).insertAdjacentHTML('beforeend', html);
      break;

    case 'ame-results-header':
      html = `
	<p>
          AME outputs a tab-separated values (TSV) file ('ame.tsv') that contains one line for each motif
	  found to be significantly enriched.
	  The lines are sorted in order of decreasing statistical significance.
          The first line contains the (tab-separated) names of the fields.
	  Your command line is given at the end of the file in a comment line starting with the
	  character '#'.
	</p>
      `;
      document.getElementById(id).insertAdjacentHTML('beforeend', html);
      break;

    case 'ame-results-table':
      html = `
	<p>
	  The <a href="` + site_url + `/doc/ame-output-format.html#tsv_results">AME Results TSV Format</a> 
	  differs depending on the choice of method for measuring motif enrichment, as shown in the following table. 
	</p>
	<table style="width:100%" border=1>
	  <tr>
	    <th>Method</th>
	    <th colspan=19>Output Columns</th>
	  </tr>
	  <tr>
	    <th></th> 
	    <th>1</th>
	    <th>2</th>
	    <th>3</th>
	    <th>4</th>
	    <th>5</th>
	    <th>6</th>
	    <th>7</th>
	    <th>8</th>
	    <th>9</th>
	    <th>10</th>
	    <th>11</th>
	    <th>12</th>
	    <th>13 </th>
	    <th>14 </th>
	    <th>15 </th>
	    <th>16 </th>
	    <th>17 </th>
	    <th>18 </th>
	    <th>19 </th>
	  </tr>
	  <tr>
	    <td>fisher</td>
	    <td>rank </td>
	    <td>motif_DB </td>
	    <td>motif_ID </td>
	    <td>motif_alt_ID </td>
	    <td>consensus </td>
	    <td>p-value </td>
	    <td>adj_p-value </td>
	    <td>E-value</td>
	    <td>tests </td>
	    <td>FASTA_max </td>
	    <td>pos </td>
	    <td>neg </td>
	    <td>PWM_min</td>
	    <td>TP </td>
	    <td>%TP </td>
	    <td>FP </td>
	    <td>%FP </td>
	    </td> <td>
	    </td> <td>
	  </tr>
	  <tr>
	    <td>ranksum</td>
	    <td>rank </td>
	    <td>motif_DB </td>
	    <td>motif_ID </td>
	    <td>motif_alt_ID </td>
	    <td>consensus </td>
	    <td>p-value </td>
	    <td>adj_p-value </td>
	    <td>E-value</td>
	    <td>tests </td>
	    <td>FASTA_max </td>
	    <td>pos </td>
	    <td>neg</td>
	    <td>U </td>
	    <td>pleft </td>
	    <td>pright </td>
	    <td>pboth </td>
	    <td>adj_pleft </td>
	    <td>adj_pright </td>
	    <td>adj_both</td>
	  </tr>
	  <tr>
	    <td>3dmhg</td>
	    <td>rank </td>
	    <td>motif_DB </td>
	    <td>motif_ID </td>
	    <td>motif_alt_ID </td>
	    <td>consensus </td>
	    <td>p-value </td>
	    <td>adj_p-value </td>
	    <td>E-value</td>
	    <td>tests </td>
	    <td>FASTA_max </td>
	    <td>pos </td>
	    <td>neg</td>
	    </td> <td>
	    </td> <td>
	    </td> <td>
	    </td> <td>
	    </td> <td>
	    </td> <td>
	    </td> <td>
	  </tr>
	  <tr>
	    <td>4dmhg</td>
	    <td>rank </td>
	    <td>motif_DB </td>
	    <td>motif_ID </td>
	    <td>motif_alt_ID </td>
	    <td>consensus </td>
	    <td>p-value </td>
	    <td>adj_p-value </td>
	    <td>E-value</td>
	    <td>tests </td>
	    <td>FASTA_max </td>
	    <td>pos </td>
	    <td>neg</td>
	    </td> <td>
	    </td> <td>
	    </td> <td>
	    </td> <td>
	    </td> <td>
	    </td> <td>
	    </td> <td>
	  </tr>
	  <tr>
	    <td>pearson</td>
	    <td>rank </td>
	    <td>motif_DB </td>
	    <td>motif_ID </td>
	    <td>motif_alt_ID </td>
	    <td>consensus </td>
	    <td>p-value </td>
	    <td>adj_p-value </td>
	    <td>E-value</td>
	    <td>tests </td>
	    <td>Pearson_CC </td>
	    <td>mean_squared_error </td>
	    <td>slope </td>
	    <td>intercept</td>
	    </td> <td>
	    </td> <td>
	    </td> <td>
	    </td> <td>
	    </td> <td>
	    </td> <td>
	  </tr>
	  <tr>
	    <td>spearman</td>
	    <td>rank </td>
	    <td>motif_DB </td>
	    <td>motif_ID </td>
	    <td>motif_alt_ID </td>
	    <td>consensus </td>
	    <td>p-value </td>
	    <td>adj_p-value </td>
	    <td>E-value</td>
	    <td>tests </td>
	    <td>Spearman_CC</td>
	    </td> <td>
	    </td> <td>
	    </td> <td>
	    </td> <td>
	    </td> <td>
	    </td> <td>
	    </td> <td>
	    </td> <td>
	    </td> <td>
	  </tr>
        </table>
      `;
      document.getElementById(id).insertAdjacentHTML('beforeend', html);
      break;

    case 'ame-results-description':
      html = `
        <p>
          The names and meanings of each of the fields in <a href="` + site_url + `/doc/ame-output-format.html#tsv_results">AME Results TSV Format</a>,
          which depend on the method of enrichment analysis you chose, are described below.
        </p>
        <table class="dark" style="width:100%" border=1>
	  <tr> <th>method</th> <th>field</th> <th>name</th> <th>contents</th> </tr>	
    	  <tr> <td>all</td> <td>1</td> <td>rank</td> <td>The rank of the significance of the motif in the sorted results.</td> </tr>
    	  <tr> <td>all</td> <td>2</td> <td>motif_DB</td> <td> ` + get_doc_text('motif-db', 'the motif.') + `</td> </tr>
    	  <tr> <td>all</td> <td>3</td> <td>motif_ID</td> <td> ` + get_doc_text('motif-id') + `</td> </tr>
    	  <tr> <td>all</td> <td>4</td> <td>motif_alt_ID</td> <td> ` + get_doc_text('motif-alt-id') + `</td> </tr>
    	  <tr> <td>all</td> <td>5</td> <td>consensus</td> <td> ` + get_doc_text('motif-cons') + `</td> </tr>
    	  <tr> <td>all</td> <td>6</td> <td>p-value</td> <td> ` + get_doc_text('ame-pvalue') + `</td> </tr>
    	  <tr> <td>all</td> <td>7</td> <td>adj_p-value</td> <td> ` + get_doc_text('ame-adj-pvalue') + `</td> </tr>
    	  <tr> <td>all</td> <td>8</td> <td>E-value</td> <td> ` + get_doc_text('ame-evalue') + `</td> </tr>
    	  <tr> <td>all</td> <td>9</td> <td>tests</td> <td>The number of tests performed; used in correcting the <i>p</i>-value</td> </tr>
	  <tr> <td colspan=4></td>
          <tr> <td>fisher, ranksum, 3dmhg, 4dmhg</td> <td>10</td> <td>FASTA_max</td> <td>The optimal threshold for <b>labeling</b> sequences as positive;
            sequences with FASTA score less than or equal to the threshold are labeled as positive;
            this field will be contain the number of primary sequences if you provided
            a control file (using option <code>--control</code>); this field will contain the size of the
            partition if you specified one (using option <code>--fix-partition</code>).</td> </tr>
          <tr> <td>fisher, ranksum, 3dmhg, 4dmhg</td> <td>11</td> <td>pos</td> <td>The number of sequences <b>labeled</b> as positive.</td> </tr>
          <tr> <td>fisher, ranksum, 3dmhg, 4dmhg</td> <td>12</td> <td>neg</td> <td>The number of sequences <b>labeled</b> as negative.</td> </tr>
	  <tr> <td colspan=4></td>
          <tr> <td>fisher</td> <td>13</td> <td>PWM_min</td> <td>The optimal threshold on PWM score for <b>classifying</b> sequences as positive;
                sequences with PWM score greater than or equal to the threshold are classified as positive.</td> </tr>
          <tr> <td>fisher</td> <td>14</td> <td>TP</td> <td>The number of true positive sequences: sequences both <b>labeled</b> and <b>classified</b> as positive</td> </tr>
          <tr> <td>fisher</td> <td>15</td> <td>%TP</td> <td>The percentage of true positive sequences: percentage of sequences <b>labeled</b> positive and <b>classified</b> as positive.</td> </tr>
          <tr> <td>fisher</td> <td>16</td> <td>FP</td> <td>The number of false positive sequences: sequences <b>labeled</b> negative but <b>classified</b> as positive.</td> </tr>
          <tr> <td>fisher</td> <td>17</td> <td>%TP</td> <td>The percentage of false positive sequences: sequences <b>labeled</b> negative but <b>classified</b> as positive.</td> </tr>
	  <tr> <td colspan=4></td>
          <tr> <td>ranksum</td> <td>13</td> <td>U</td> <td>The value of the Mann-Whitney <i>U</i> statistic.</td> </tr>
          <tr> <td>ranksum</td> <td>14</td> <td>pleft</td> <td>The left-tailed <i>p</i>-value of the rank-sum test.</td> </tr>
          <tr> <td>ranksum</td> <td>15</td> <td>pright</td> <td>The right-tailed <i>p</i>-value of the rank-sum test.</td> </tr>
          <tr> <td>ranksum</td> <td>16</td> <td>pboth</td> <td>The two-tailed <i>p</i>-value of the rank-sum test.</td> </tr>
          <tr> <td>ranksum</td> <td>17</td> <td>adj_pleft</td> <td>The left-tailed <i>p</i>-value of the rank-sum test, adjusted for multiple tests.</td> </tr>
          <tr> <td>ranksum</td> <td>18</td> <td>adj_pright</td> <td>The right-tailed <i>p</i>-value of the rank-sum test, adjusted for multiple tests.</td> </tr>
          <tr> <td>ranksum</td> <td>19</td> <td>adj_both</td> <td>The two-tailed <i>p</i>-value of the rank-sum test, adjusted for multiple tests.</td> </tr>
	  <tr> <td colspan=4></td>
	  <tr> <td>pearson</td> <td>10</td> <td>Pearson_CC</td> <td>The correlation coefficient of the PWM and FASTA scores of positive sequences.</td> </tr>
	  <tr> <td>pearson</td> <td>11</td> <td>mean_squared_error</td> <td>The mean-squared error of the regression line between PWM and FASTA scores.</td> </tr>
	  <tr> <td>pearson</td> <td>12</td> <td>slope</td> <td>The slope of the regression line.</td> </tr>
	  <tr> <td>pearson</td> <td>13</td> <td>intercept</td> <td>The y-intercept of the regression line.</td> </tr>
	  <tr> <td colspan=4></td>
	  <tr> <td>spearman</td> <td>10</td> <td>Spearman_CC</td> <td>The correlation coefficient of the PWM and FASTA ranks of positive sequences./td> </tr>
        </table>
	  </ul>
	</p>
      `;
      document.getElementById(id).insertAdjacentHTML('beforeend', html);
      break;

    case 'ame-sequences-tsv':
      html = `
        <p>AME outputs a tab-separated values (TSV) file ('sequences.tsv') containing one line for
	each sequence classified as 'positive' by AME for each significant motif.
        The first line contains the (tab-separated) names of the fields.
	The lines are grouped by motif, and groups are separated by a line
	starting with the character "#".
        </p>
        <p>
          The names and meanings of each of the fields in <a href="` + site_url + `/doc/ame-output-format.html#tsv_sequences">AME Significant Sequences TSV Format</a>,
          are described below.
        </p>
        <table class="dark" style="width:100%" border=1>
          <tr> <th>field</th> <th>name</th> <th>contents</th> </tr>
	  <tr> <td>1</td> <td>motif_DB</td> <td>` + get_doc_text('motif-db', 'the motif.') + `</td> </tr>
	  <tr> <td>2</td> <td>motif_ID</td> <td>the ID of the motif</td> </tr>
	  <tr> <td>3</td> <td>seq_ID</td> <td>the ID of the sequence</td> </tr>
	  <tr> <td>4</td> <td><i>label_score</i> (either FASTA_score or PWM_score)</td> <td>the value of the score used to label it as positive</td> </tr>
	  <tr> <td>5</td> <td><i>class_score</i> (either PWM_score or FASTA_score)</td> <td>the value of the score used to classify it as positive</td> </tr>
	  <tr> <td>6</td> <td>class</td> <td>whether the sequence is a true positive, 'tp', or a false positive, 'fp'</td> </tr>
        </table>
      `;
      document.getElementById(id).insertAdjacentHTML('beforeend', html);
      break;

    case 'centrimo-results-tsv':
      html = `
	<p>
          CentriMo outputs a tab-separated values (TSV) file ('centrimo.tsv') that contains one line for each 
	  region found to be significantly enriched for a motif.
	  The lines are sorted in order of decreasing statistical significance.
          The first line contains the (tab-separated) names of the fields.
          Your command line is given at the end of the file in a comment line starting with the
          character '#'.
	</p>
	<p>
          The names and meanings of each of the fields in <a href="` + site_url + `/doc/centrimo-output-format.html#tsv_results">CentriMo Results TSV Format</a>,
          which depend on whether or not you provide control sequences to CentriMo, are described below.
	</p>
        <table class="dark" style="width:100%" border=1>
          <tr> <th>field</th> <th>name</th> <th>contents</th> </tr>
	  <tr> <td>1</td> <td>db_index</td> <td>The index of the motif file that contains the motif.  Motif
	      files are numbered in the order the appeared in the command line.</td> </tr>
	  <tr> <td>2</td> <td>motif_id</td> <td> ` + get_doc_text('motif-id') + `
	      If more than one motif has the same ID, CentriMo uses only the first such motif.
	      The name is single-quoted and preceded with '+' or '-' if you scanned separately with 
	      the reverse complement motif (using the <code>--sep</code> option).</td> </tr>
	  <tr> <td>3</td> <td>motif_alt_id</td> <td> ` + get_doc_text('motif-alt-id') + `</td> </tr>
	  <tr> <td>4</td> <td>consensus</td> <td> ` + get_doc_text('motif-cons') + `</td> </tr>
	  <tr> <td>5</td> <td>E-value</td> <td> ` + get_doc_text('centrimo-evalue') + `</td> </tr>
	  <tr> <td>6</td> <td>adj_p-value</td> <td> ` + get_doc_text('centrimo-adj-pvalue') + `
	      By default, a <i>p</i>-value is calculated by using the one-tailed binomial
	      test on the number of sequences with a match to the motif
	      that have their best match in the reported region;
              if you provided control sequences, the <i>p</i>-value of Fisher\'s exact test on the enrichment of 
              best matches in the positive sequences relative to the negative sequences is computed instead;
	      if you used the <code>--cd</code> option, the <i>p</i>-value is the probability that the average 
	      distance between the best site and the sequence center would be as low or lower than observed, 
	      computed using the cumulative Bates distribution, optimized over different score thresholds.
	      In all cases, the reported <i>p</i>-value has been adjusted for the number of regions
	      and/or score thresholds tested.</td> </tr>
	  <tr> <td>7</td> <td>log_adj_p-value</td> <td>Log of adjusted <i>p</i>-value.</td> </tr>
	  <tr> <td>8</td> <td>bin_location</td> <td>Location of the center of the most enriched region, or
		0 if you used the <code>--cd</code> option.
	  <tr> <td>9</td> <td>bin_width</td> <td> ` + get_doc_text('centrimo-bin-width') + `</td> </tr>
	  <tr> <td>10</td> <td>total_width</td> <td>The maximum number of regions possible for this motif
              <br>&nbsp;&nbsp;
	      round(sequence_length - motif_length + 1)/2,<br>
	      or the number of places the motif will fit if you used the <code>--cd</code> option.</td> </tr>
	  <tr> <td>11</td> <td>sites_in_bin</td> <td> ` + get_doc_text('centrimo-sites-in-bin') + `</td> </tr>
	  <tr> <td>12</td> <td>total_sites</td> <td>The number of sequences containing a match to the motif
	      above the score threshold.
	  <tr> <td>13</td> <td>p_success</td> <td>The probability of a random match falling into the enriched region:
	      <br>&nbsp;&nbsp;
	      bin_width / total_width</td> </tr>
	  <tr> <td>14</td> <td>p-value</td> <td>The uncorrected <i>p</i>-value before it gets adjusted for the
	      number of multiple tests to give the adjusted <i>p</i>-value.</td> </tr>
	  <tr> <td>15</td> <td>mult_tests</td> <td> ` + get_doc_text('centrimo-mult-tests') + `</td> </tr>
	  <tr> <th colspan=3>The following additional columns are present when you provide control sequences to CentriMo
	  (using the <code>--neg</code> option).</th> </tr>
	  <tr> <td>16</td> <td>neg_sites_in_bin</td> <td>The number of negative sequences where the best
	      match to the motif falls in the reported region.
	      This value is rounded but the underlying value may contain fractional counts.
	      Note: This number may be less than the number of negative have a best match in the region.
	      The reason for this is that a sequence may have many matches that score equally best.
	      If n matches have the best score in a sequence, 1/n is added to the
	      appropriate bin for each match.</td> </tr>
	  <tr> <td>17</td> <td>neg_sites</td> <td>The number of negative sequences containing a match to the
	      motif above the minimum score threshold.
	      When score optimization is enabled the score threshold may be raised
	      higher than the minimum.</td> </tr>
	  <tr> <td>18</td> <td>neg_adj_pvalue</td> <td>The probability that any tested region in the negative
	      sequences would be as enriched for best matches to this motif
	      according to the Binomial test.</td> </tr>
	  <tr> <td>19</td> <td>log_neg_adj_pvalue</td> <td>Log of negative adjusted <i>p</i>-value.</td> </tr>
	  <tr> <td>20</td> <td>fisher_adj_pvalue</td> <td>Fisher adjusted <i>p</i>-value before it gets adjusted for the
	      number of motifs in the input files(s).</td> </tr>
	  <tr> <td>21</td> <td>log_fisher_adj_pvalue</td> <td>Log of Fisher adjusted <i>p</i>-value.</td> </tr>
        </table>
      `;
      document.getElementById(id).insertAdjacentHTML('beforeend', html);
      break;

    case 'centrimo-sites-txt':
      html = `
	<p>
          CentriMo outputs a text file ('site_counts.txt') that contains,
	  for each motif, pairs of values (bin_position, site_count),
	  or triples of values (bin_position, site_count, neg_site_count) if
	  you provided control sequences to CentriMo.
	  This data can be used to plot the density of motif best matches (sites)
	  along the input sequences.  Fractional counts are possible if multiple (n)
	  bins contain the best match for a given sequence, with each bin  
	  receiving an incremental count of 1/n. 
	</p>
	<p>
	  The data for each motif begins with a header line with the format:
	  <br>&nbsp&nbsp
		DB &lt;db_number&gt; MOTIF &lt;id&gt; &lt;alt&gt;
	  </br>
	  where &lt;id&gt; and &lt;alt&gt; are as described above.
	  The following lines (up to the next header line) 
	  each contain a single value-pair or value-triple for the motif
	  named in the header line.
	</p>
      `;
      document.getElementById(id).insertAdjacentHTML('beforeend', html);
      break;

    case 'meme-chip-results-tsv':
      html = `
	<p>
          MEME-ChIP outputs a tab-separated values (TSV) file ('summary.tsv') that 
	  contains one line for each motif found by MEME-ChIP.
	  The lines are sorted in order of decreasing statistical significance.
	  The first line contains the (tab-separated) names of the fields.
	  Your command line is given at the end of the file in a comment line starting with the
	  character '#'.
	</p>
	<p>
          The names and meanings of the fields in the 
	  <a href="` + site_url + `/doc/meme-chip-output-format.html">MEME-ChIP Results Summary TSV Format</a> 
	  are described below. 
	</p>
        <table class="dark" style="width:100%" border=1>
          <tr> <th>field</th> <th>name</th> <th>contents</th> </tr>
          <tr> <td>1</td> <td>MOTIF_INDEX</td> <td>The index of the motif in the "Motifs in MEME text format" file ('combined.meme') 
		output by MEME-ChIP.</td> </tr>
          <tr> <td>2</td> <td>MOTIF_SOURCE</td> <td>The name of the program that found the <i>de novo</i> motif, or the
                name of the motif file containing the known motif.</td> </tr>
          <tr> <td>3</td> <td>MOTIF_ID</td> <td> ` + get_doc_text('motif-id') + `</td> </tr>
          <tr> <td>4</td> <td>ALT_ID</td> <td> ` + get_doc_text('motif-alt-id') + `</td> </tr>
          <tr> <td>5</td> <td>CONSENSUS</td> <td>The ID of the <i>de novo</i> motif, or a consensus sequence
                computed from the letter frequencies in the known motif
                (as described <a href="#consensus_doc">below</a>).</td> </tr>
          <tr> <td>6</td> <td>WIDTH</td> <td>The width of the motif.</td> </tr>
          <tr> <td>7</td> <td>SITES</td> <td>The number of sites reported by the <i>de novo</i> program, or the number
                of "Total Matches" reported by CentriMo.</td> </tr>
          <tr> <td>8</td> <td>E-VALUE</td> <td>The statistical significance of the motif.</td> </tr>
          <tr> <td>9</td> <td>E-VALUE_SOURCE</td> <td>The program that reported the <i>E</i>-value.</td> </tr>
          <tr> <td>10</td> <td>MOST_SIMILAR_MOTIF</td> <td>The known motif most similar to this motif according to Tomtom.</td> </tr>
          <tr> <td>11</td> <td>URL</td> <td>A link to a description of the most similar motif, or to the known motif.</td> </tr>
        </table>
      `;
      document.getElementById(id).insertAdjacentHTML('beforeend', html);
      break;

    case 'meme-chip-combined-motifs':
      html = `
        <p>
          MEME-ChIP outputs a text file ('combined.meme') containing all the significant motifs found by MEME-ChIP.
          The motifs are in <a href="` + site_url + `/doc/meme-format.html">Minimal MEME Motif format</a>, 
	  and their IDs correspond to the motif indices given in the "Summary in TSV Format" file ('summary.tsv').
        </p>
        </p>
          <b>Note:</b> The 'nsites=' and 'E=' fields in the motif headers are only
          relevant for the MEME and DREME motifs.  For known motifs, those values do
          not refer to the number of sites in the input sequences.
        </p>
      `;
      document.getElementById(id).insertAdjacentHTML('beforeend', html);
      break;

    case 'spamo-results-tsv':
      html = `
	<p>
          SpaMo outputs a tab-separated values (TSV) file ('spamo.tsv') that contains one line for each motif
	  found to be significantly enriched.
	  The lines are grouped by secondary motif and sorted in order of decreasing statistical significance.
          The first line contains the (tab-separated) names of the fields.
	  Your command line is given at the end of the file in a comment line starting with the character '#'.
	</p>
	<p>
	  The names and meanings of each of the fields in <a href="` + site_url + `/doc/spamo-output-format.html#results-tsv">SpaMo Results TSV Format</a> 
	  are described below. 
	</p>
	<table class="dark" style="width:100%" border=1>
	  <tr> <th>field</th> <th>name</th> <th>contents</th> </tr>
          <tr> <td>1</td> <td>prim_db</td> <td> ` + get_doc_text('motif-db', 'the primary motif.') + `</td> </tr>
          <tr> <td>2</td> <td>prim_id</td> <td> ` + get_doc_text('motif-id', 'primary') + `</td> </tr>
          <tr> <td>3</td> <td>prim_alt</td> <td> ` + get_doc_text('motif-alt-id', 'primary') + `</td> </tr>
          <tr> <td>4</td> <td>prim_cons</td> <td> ` + get_doc_text('motif-cons', 'primary') + `</td> </tr>
          <tr> <td>5</td> <td>sec_db</td> <td> ` + get_doc_text('motif-db', 'the secondary motif.') + `</td> </tr>
          <tr> <td>6</td> <td>sec_id</td> <td> ` + get_doc_text('motif-id', 'secondary') + `</td> </tr>
          <tr> <td>7</td> <td>sec_alt</td> <td> ` + get_doc_text('motif-alt-id', 'secondary') + `</td> </tr>
          <tr> <td>8</td> <td>sec_cons</td> <td> ` + get_doc_text('motif-cons', 'secondary') + `</td> </tr>
          <tr> <td>9</td> <td>trim_left</td> <td>Number of positions trimmed from left of secondary motif.</td> </tr>
          <tr> <td>10</td> <td>trim_right</td> <td>Number of positions trimmed from right of secondary motif.</td> </tr> 
          <tr> <th colspan=3>If the next three fields are not blank, the motif is redundant with a more significant ('parent') motif.</th> </tr>
          <tr> <td>11</td> <td>red_db</td> <td> ` + get_doc_text('motif-db', 'the parent motif.') + `</td> </tr>
          <tr> <td>12</td> <td>red_id</td> <td> ` + get_doc_text('motif-id', 'parent') + `</td> </tr>
          <tr> <td>13</td> <td>red_alt</td> <td> ` + get_doc_text('motif-alt-id', 'parent') + `</td> </tr>
          <tr> <td>14</td> <td>E-value</td> <td>The expected number motifs that would have least one spacing as enriched as the best spacing for this secondary. 
	    The <i>E</i>-value is the best spacing <i>p</i>-value multiplied by the number of motifs in the input database(s).</td> </tr>
          <tr> <td>15</td> <td>gap</td> <td>The distance between the edge of the primary and the (trimmed) secondary motif.</td> </tr>
          <tr> <td>16</td> <td>orient</td> <td>The (combination) of quadrants for which occurrences of this spacing are combined.</td> </tr>
          <tr> <td>17</td> <td>count</td> <td>The number of occurrences of the secondary motif with the given spacing and orientation to the primary motif.</td> </tr>
          <tr> <td>18</td> <td>total</td> <td>The total number of occurrences of the secondary motif within the margins around the best primary motif occurrence.</td> </tr>
          <tr> <td>19</td> <td>adj_p-value</td> <td>The <i>p</i>-value of the gap and orientation, adjusted for nine combinations of quadrants times the number of gaps tested (as controlled by the <code>-range</code> option).</td> </tr>
          <tr> <td>20</td> <td>p-value</td> <td>The <i>p</i>-value of the gap and orientation adjusted only for the number of gaps tested.</td> </tr>
        </table>
        <br>
      `;
      document.getElementById(id).insertAdjacentHTML('beforeend', html);
      break;

    case 'spamo-dumpseqs-tsv':
      html = `
	<p>
	  By specifying the options <code>--dumpseqs</code> or <code>--dumpsigs</code> 
	  you can have SpaMo create TSV (tab-separated values) files
	  describing the motif matches SpaMo used to make the histograms in its HTML output.
	  The files are named 
          '<code>seqs_&lt;primary_motif&gt;_&lt;secondary_db&gt;_&lt;secondary_motif&gt;.txt</code>'.
	  The rows in each file are sorted by sequence name.  
	  The first line contains the (tab-separated) names of the fields.
        </p>
	<p>
	  The names and meanings of each of the fields in <a href="` + site_url + `/doc/spamo-output-format.html#tsv_dumpseqs">SpaMo Dumpseqs TSV Format</a> 
	  are described below. 
        </p>
	<table class="dark" style="width:100%">
	  <tr><th>field</th><th>name</th><th>contents</th></tr>
	  <tr><td>1</td><td>matches</td><td>Trimmed lowercase sequence centered on primary match with matches in uppercase.</td></tr>
	  <tr><td>2</td><td>sec_pos</td><td>Position of the secondary match within the whole sequence.</td></tr>
	  <tr><td>3</td><td>pri_match</td><td>Sequence fragment that the primary matched.</td></tr>
	  <tr><td>4</td><td>pri_strand</td><td>Strand of the primary match (+/-).</td></tr>
	  <tr><td>5</td><td>sec_match</td><td>Sequence fragment that the secondary matched.</td></tr>
	  <tr><td>6</td><td>sec_strand</td><td>Strand of the secondary match (+/-).</td></tr>
	  <tr><td>7</td><td>same_opp</td><td>The primary match on the same (s) or opposite (o) strand as the secondary.</td></tr>
	  <tr><td>8</td><td>down_up</td><td>The secondary match is downstream (d) or upstream (u) of the primary.</td></tr>
	  <tr><td>9</td><td>gap</td><td>The gap between the primary and secondary matches.</td></tr>
	  <tr><td>10</td><td>seq_name</td><td>The name of the sequence.</td></tr>
	  <tr><td>11</td><td>adj_p-value</td><td>The <i>p</i>-value of the bin containing the match, adjusted for the number of bins.</td></tr>
	  <tr><th colspan="3">If the sequence names are in UCSC Genome Browser position
	  format (e.g., "chr5:36715616-36715623"), the following additional fields will be present:</th></tr>
	  <tr><td>12</td><td>pri_bed_chr</td><td>Position of primary match in BED coordinates.</td></tr>
	  <tr><td>13</td><td>pri_bed_start</td><td>"</td></tr>
	  <tr><td>14</td><td>pri_bed_end</td><td>"</td></tr>
	  <tr><td>15</td><td>pri_browser</td><td>Position of primary match in UCSC Genome Browser coordinates.</td></tr>
	  <tr><td>16</td><td>sec_bed_chr</td><td>Position of secondary match in BED coordinates.</td></tr>
	  <tr><td>16</td><td>sec_bed_start</td><td>"</td></tr>
	  <tr><td>16</td><td>sec_bed_end</td><td>"</td></tr>
	  <tr><td>19</td><td>sec_browser</td><td>Position of secondary match in UCSC Genome Browser coordinates.</td></tr>
	</table>
      `;
      document.getElementById(id).insertAdjacentHTML('beforeend', html);
      break;

    case 'fimo-results-tsv':
      html = ` 
        <p>
          FIMO outputs a tab-separated values (TSV) file ('fimo.tsv') that contains one line for each
          significant match to a motif.
          The lines are sorted in order of decreasing statistical significance (increasing <i>p</i>-value).
          The first line contains the (tab-separated) names of the fields.
          Your command line is given at the end of the file in a comment line starting with the
          character '#'.
        </p>
	<p>
	  The names and meanings of each of the fields in <a href="` + site_url + `/doc/fimo-output-format.html#results-tsv">FIMO Results TSV Format</a> 
	  are described below. 
	</p>
	<table class="dark" style="width:100%" border=1>
	  <tr> <th>field</th> <th>name</th> <th>contents</th> </tr>
          <tr> <td>1</td> <td>motif_id</td> <td> ` + get_doc_text('motif-id') + `</td> </tr>
          <tr> <td>2</td> <td>motif_alt_id</td> <td> ` + get_doc_text('motif-alt-id') + `</td> </tr>
          <tr> <td>3</td> <td>sequence_name</td> <td> ` + get_doc_text('sequence-id') + ` --OR-- the `
	    + get_doc_text('sequence-name') + `</td> </tr>
          <tr> <td>4</td> <td>start</td> <td> ` + get_doc_text('match-start-seq', 'motif occurrence') + ` --OR-- `
            + get_doc_text('match-start-genomic', 'motif occurrence') 
            + get_doc_text('parse-genomic-coord', 'The latter case occurs when FIMO') + `</td> </tr>
          <tr> <td>5</td> <td>stop</td> <td> ` + get_doc_text('match-stop-seq', 'motif occurrence') + ` --OR-- `
            + get_doc_text('match-stop-genomic', 'motif occurrence') 
            + get_doc_text('parse-genomic-coord', 'The latter case occurs when FIMO') + `</td> </tr>
          <tr> <td>6</td> <td>strand</td> <td>The strand '<code>+</code>' indicates the motif matched the forward
	    strand, '<code>-</code>' the reverse strand, and '<code>.</code>'
	    indicates strand is not applicable (as for amino acid sequences).</td> </tr>
          <tr> <td>7</td> <td>score</td> <td>The score for the motif occurrence. `
            + get_doc_text('motif-match-score') + `</td> </tr>
          <tr> <td>8</td> <td>p-value</td> <td> The <i>p</i>-value of the motif occurrence. `
            + get_doc_text('motif-match-p-value') + `</td> </tr>
          <tr> <td>9</td> <td>q-value</td> <td>The q-value of the motif occurrence. `
            + get_doc_text('bh-q-value', 'FIMO') + ` <b>Note:</b> This column is empty if you used the <span class=popt>--text</span> switch.</td> </tr>
          <tr> <td>10</td> <td>sequence</td> <td>The region of the sequence matched to the motif.</td> </tr>
        </table>
      `;
      document.getElementById(id).insertAdjacentHTML('beforeend', html);
      break;

    case 'fimo-results-gff3':
      html = `
        <p>
          FIMO outputs a GFF3</a> file ('fimo.gff') that contains one line for each
          significant match to a motif.
        </p>
        <p>
	  The GFF3 format is described <a href="http://gmod.org/wiki/GFF3">here</a>.
	  The 'score' reported in the FIMO GFF3 output</a> (in column 6) is<br/>
	  &nbsp;&nbsp;&nbsp;&nbsp;<code>min(1000, -10*(log10(pvalue)))</code>, <br/>
	  and the 'display name' ('Name=' tag in column 9) is composed of the contents of three 
	  fields as follows <br/>
	  &nbsp;&nbsp;&nbsp;&nbsp;<code>&lt;motif_id&gt;_&lt;sequence_name&gt;&lt;strand&gt;</code>.
        </p>
      `;
      document.getElementById(id).insertAdjacentHTML('beforeend', html);
      break;

    case 'gomo-results-tsv':
      html = `
        <p>
          GOMo outputs a tab-separated values (TSV) file ('gomo.tsv') that contains one line for each 
	  motif-GO-term pair found to be significantly enriched.
          The lines are grouped by motif and sorted in order of decreasing statistical significance.
          The first line contains the (tab-separated) names of the fields.
          Your command line is given at the end of the file in a comment line starting with the character '#'.
        </p>
        <p>
          The names and meanings of each of the fields in <a href="` + site_url + `/doc/gomo-output-format.html#results-tsv">GOMo Results TSV Format</a>
          are described below.
        </p>
        <table class="dark" style="width:100%" border=1>
          <tr> <th>field</th> <th>name</th> <th>contents</th> </tr>
          <tr> <td>1</td> <td>Motif_Identifier</td> <td> ` + get_doc_text('motif-id') + ` </td> </tr> 
          <tr> <td>2</td> <td>GO_Term_Identifier</td> <td> ` + get_doc_text('gomo-go-term') + ` </td> </tr>
          <tr> <td>3</td> <td>GOMo_Score</td> <td> ` + get_doc_text('gomo-score') + ` </td> </tr>
          <tr> <td>4</td> <td>p-value</td> <td> ` + get_doc_text('gomo-p-value') + ` </td> </tr>
          <tr> <td>5</td> <td>q-value</td> <td> ` + get_doc_text('bh-q-value', 'GOMo') + ` </td> </tr>
        </table>
      `;
      document.getElementById(id).insertAdjacentHTML('beforeend', html);
      break;

    case 'gomo-results-xml':
      html = `
	<p>
	GOMo outputs an XML file ('gomo.xml') with the following format.
	</p>
	<table class="bordertable" border="1">
	  <tr>
	    <th>Tag</th><th>Child of</th><th>Description</th>
	  </tr>
	  <tr>
	    <td >&lt;gomo&gt;</td><td >Nothing</td>
	    <td>
	      Information about this run of GOMo.
	      <ul>
		<li>version - The version of GOMo that generated the XML file.</li>
		<li>release - The release date of the version that generated the XML.</li>
	      </ul>
	    </td>
	  </tr>
	  <tr>
	    <td >&lt;program&gt;</td>
	    <td >&lt;gomo&gt;</td>
	    <td>
	      Information about the state of the program when it ran.<br />
	      <ul>
		<li>name - name of the program.</li>
		<li>cmd - the command line passed to the program.</li>
		<li>gene_url - the url used to lookup further information on the gene ids. 
		The url has ampersands (&amp;) converted into <b>&amp;amp;</b> and the place where
		  the gene ID should be replaced by <b>!!GENEID!!</b> .</li>
		<li>outdir - the output directory that the program wrote to.</li>
		<li>clobber - true if GOMo was allowed to overwrite the output directory.</li>
		<li>text_only - true if GOMo wrote to stdout, in which case this file would
		  not exist so it must be false.</li>
		<li>use_e_values - true if GOMo used <i>E</i>-values (converted from <i>p</i>-values) as 
		  input scores, false if GOMo used gene scores.</li>
		<li>score_e_thresh - if GOMo used <i>E</i>-values then this is the threshold that 
		  GOMo assumed the worst <i>E</i>-value (<i>p</i>-value = 1.0) for the gene to smooth out noise.</li>
		<li>min_gene_count - the minimum number of genes that a GO term was annotated 
		  with before GOMo would calculate a score for it.</li>
		<li>motifs - if present then a space delimited list of the motifs that GOMo
		  calculated a score for, otherwise GOMo scored all motifs.</li>
		<li>shuffle_scores - the number of times GOMo generated a shuffled mapping of
		  gene id to gene id to be used to generate scores from the null model.</li>
		<li>q_threshold - GOMo filtered the results to only show those with a better
		(smaller) q-value.</li>
	      </ul>
	    </td>
	  </tr>
	  <tr>
	    <td>&lt;gomapfile&gt;</td>
	    <td>&lt;program&gt;</td>
	    <td>
	      Information about the GO mapping file.<br />
	      <ul>
		<li>path - the path to the mapping file.</li>
	      </ul>
	    </td>
	  </tr>
	  <tr>
	    <td>&lt;seqscorefile&gt;</td>
	    <td>&lt;program&gt;</td>
	    <td>
	      Information about the sequence scoring file.<br />
	      <ul>
		<li>path - the path to the sequence scoring file.</li>
	      </ul>
	    </td>
	  </tr>
	  <tr>
	    <td>&lt;motif&gt;</td>
	    <td>&lt;gomo&gt;</td>
	    <td>
	      Information about the motif.<br />
	      <ul>
		<li>id - the motif identifier.</li>
		<li>genecount - the number of scored sequences that were used to compute the result.</li>
	      </ul>
	    </td>
	  </tr>
	  <tr>
	    <td>&lt;goterm&gt;</td>
	    <td>&lt;motif&gt;</td>
	    <td>
	      Information about the GO term.<br />
	      <ul>
		<li>id - the GO identifier.</li>
		<li>score - the geometric mean across all species of the rank-sum test <i>p</i>-value.</li>
		<li>pvalue - the empirically calculated <i>p</i>-value.</li>
		<li>qvalue - the empirically calculated q-value.</li>
		<li>annotated - the number of genes annotated with the go term.</li>
		<li>group - the subgroup that the term belongs to. For the Gene Ontology 
		    b = biological process, c = cellular component and m = molecular function.</li>
		<li>nabove - the number of more general terms that link to this one.</li>
		<li>nbelow - the number of more specific terms that link from this one.</li>
		<li>implied - is the go term implied by other significant go terms? 
		  Allows values 'y', 'n' or 'u' (default) for yes, no or unknown.</li>
		<li>description - the GO term description.</li>
	      </ul>
	    </td>
	  </tr>
	  <tr>
	    <td>&lt;gene&gt;</td>
	    <td>&lt;goterm&gt;</td>
	    <td>
	      Information about the GO term's annotated genes for the primary species.<br />
	      <ul>
		<li>id - the gene identifier.</li>
		<li>rank - the rank of the scored gene.</li>
	      </ul>
	    </td>
	  </tr>
        </table>
      `;
      document.getElementById(id).insertAdjacentHTML('beforeend', html);
      break;

    case 'mcast-results-tsv':
      html = ` 
        <p>
          MCAST outputs a tab-separated values (TSV) file ('mcast.tsv') that contains one line for each
          significant match of a cluster of motifs to a sequence region.
          The lines are sorted in order of decreasing statistical significance (increasing <i>p</i>-value).
          The first line contains the (tab-separated) names of the fields.
          Your command line is given at the end of the file in a comment line starting with the
          character '#'.
        </p>
	<p>
	  The names and meanings of each of the fields in 
          <a href="` + site_url + `/doc/mcast-output-format.html#results-tsv">MCAST Results TSV Format</a> 
	  are described below. 
	</p>
	<table class="dark" style="width:100%" border=1>
	  <tr> <th>field</th> <th>name</th> <th>contents</th> </tr>
          <tr> <td>1</td> <td>pattern_name</td> <td>A unique name that MCAST generates for the match. </td> </tr>
          <tr> <td>2</td> <td>sequence_name</td> <td> ` + get_doc_text('sequence-id') + ` --OR-- the `
	    + get_doc_text('sequence-name') + `</td> </tr>
          <tr> <td>3</td> <td>start</td> <td> ` + get_doc_text('match-start-seq', 'matched sequence region') + ` --OR-- `
            + get_doc_text('match-start-genomic', 'motif occurrence')
            + get_doc_text('parse-genomic-coord', 'The latter case occurs when MCAST') + `</td> </tr>
          <tr> <td>4</td> <td>stop</td> <td> ` + get_doc_text('match-stop-seq', 'matched sequence region') + ` --OR-- `
            + get_doc_text('match-stop-genomic', 'motif occurrence')
            + get_doc_text('parse-genomic-coord', 'The latter case occurs when MCAST') + `</td> </tr>
          <tr> <td>5</td> <td>score</td> <td> ` + get_doc_text('mcast-cluster-score') + ` </td> </tr>
          <tr> <td>6</td> <td>p-value</td> <td> ` + get_doc_text('mcast-cluster-p-value') + ` </td> </tr>
          <tr> <td>7</td> <td>E-value</td> <td> ` + get_doc_text('mcast-cluster-E-value') + ` </td> </tr>
          <tr> <td>8</td> <td>q-value</td> <td> ` + get_doc_text('bh-q-value', 'MCAST') + ` 
	    <b>Note:</b> This column is empty if you used the <span class=popt>--text</span> switch.</td> </tr>
          <tr> <td>9</td> <td>sequence</td> <td>The region of the sequence matched to the motif cluster.</td> </tr>
        </table>
      `;
      document.getElementById(id).insertAdjacentHTML('beforeend', html);
      break;

    case 'mcast-results-gff3':
      html = `
        <p>
          MCAST outputs a GFF3</a> file ('mcast.gff') that contains one line for each
          significant match to a motif cluster.
        </p>
        <p>
	  The GFF3 format is described <a href="http://gmod.org/wiki/GFF3">here</a>.
	  The 'score' reported in the MCAST GFF3 output</a> (in column 6) is<br/>
	  &nbsp;&nbsp;&nbsp;&nbsp;<code>min(1000, -10*(log10(pvalue)))</code>, <br/>
	  and the 'unique identifier' ('ID=' tag in column 9) is the value of the
	  &lt;pattern_name&gt; field in the MCAST results TSV format.  Following the
	  unique identifier in column 9, the <i>p</i>-value, <i>E</i>-value and q-value
	  of the match are given.
        </p>
      `;
      document.getElementById(id).insertAdjacentHTML('beforeend', html);
      break;

    case 'tomtom-results-tsv':
      html = `
	<p>
          Tomtom outputs a tab-separated values (TSV) file ('tomtom.tsv') that contains one line for each motif
	  found to be significantly enriched.
	  The lines are grouped by query motif and sorted in order of decreasing statistical significance.
          The first line contains the (tab-separated) names of the fields.
	  Your command line is given at the end of the file in a comment line starting with the character '#'.
	</p>
	<p>
	  The names and meanings of each of the fields in <a href="` + site_url + `/doc/tomtom-output-format.html#results-tsv">Tomtom Results TSV Format</a> 
	  are described below. 
	</p>
	<table class="dark" style="width:100%" border=1>
	  <tr> <th>field</th> <th>name</th> <th>contents</th> </tr>
          <tr> <td>1</td> <td>Query_ID</td> <td> ` + get_doc_text('motif-id', 'query') + `</td> </tr>
          <tr> <td>2</td> <td>Target_ID</td> <td> ` + get_doc_text('motif-id', 'target') + `</td> </tr>
          <tr> <td>3</td> <td>Optimal_offset</td> <td> ` + get_doc_text('tomtom-offset') + `</td> </tr>
          <tr> <td>4</td> <td>p-value</td> <td> ` + get_doc_text('tomtom-p-value') + `</td> </tr>
          <tr> <td>5</td> <td>E-value</td> <td> ` + get_doc_text('tomtom-E-value') + `</td> </tr>
          <tr> <td>6</td> <td>q-value</td> <td> ` + get_doc_text('bh-q-value', 'Tomtom') + `</td> </tr>
          <tr> <td>7</td> <td>Overlap</td> <td> ` + get_doc_text('tomtom-overlap') + `</td> </tr>
          <tr> <td>8</td> <td>Query_consensus</td> <td>A consensus sequence
                computed from the letter frequencies in the query motif
                (as described <a href="#consensus_doc">below</a>).</td> </tr>
          <tr> <td>9</td> <td>Target_consensus</td> <td>A consensus sequence
                computed from the letter frequencies in the target motif
                (as described <a href="#consensus_doc">below</a>).</td> </tr>
          <tr> <td>10</td> <td>Orientation</td> <td> ` + get_doc_text('tomtom-orientation', "<br>A value of '+' means that the target motif is as it appears in the database. A value of '-' means that the reverse complement of the target motif is shown.") + `</td> </tr>
        </table>
      `;
      document.getElementById(id).insertAdjacentHTML('beforeend', html);
      break;

    default:
      html = "Error--Unrecognized doc_type: " + doc_type;
      document.getElementById(id).insertAdjacentHTML('beforeend', html);
  }
} // print_doc

//
// Function to return the HTML text of a given type.
// This function can be used directly to document the output format (xx-output-format.html)
// and indirectly via print_doc_para for help pop-ups in the actual output HTML,
// to prevent duplication of documentation.
//
function get_doc_text(doc_type, extra) {
  var html;
  if (extra == undefined) {extra = ""};

  switch (doc_type) {

    // shared
    case 'motif-db':
      return(`
	The name of a file of motifs ("motif database file") that contains ` + extra + `
      `);
    case 'motif-id':
      return(`
	The name of the ` + extra + ` motif, which is unique in the motif database file.
      `);
    case 'motif-alt-id':
      return(`
	An alternate name for the ` + extra + ` motif, which may be provided in the motif database file.
      `);
    case 'motif-width':
      return(`
	The width of the motif. No gaps are allowed in motifs supplied to ` + extra + `
        as it only works for motifs of a fixed width.
      `);
    case 'motif-cons':
      return(`
	A consensus sequence computed from the ` + extra + ` motif (as described <a href="#consensus_doc">below</a>).
      `);
    case 'motif-match-score':
     return(`
	The score for the match of a position in a sequence to a motif is
	computed by summing the appropriate entry from each column of the
	position-dependent scoring matrix that represents the motif. ` + extra + `
     `);
    case 'motif-match-p-value':
      return(`
	The <i>p</i>-value of a motif match is the probability of a single random
	subsequence of the length of the motif
	<a href="javascript:help_refine('pop_motif_match_score')">scoring</a>
	at least as well as the observed match.
      `);
    case 'bh-q-value-method':
      return(`
        ` + extra + ` estimates q-values from all the match <i>p</i>-values 
	using the method proposed by Benjamini & Hochberg (<i>Journal of the Royal Statistical Society B</i>, 57:289-300, 1995).
	See also Storey JD, Tibshirani R. Statistical significance for
	genome-wide studies, <i>Proc. Natl. Acad. Sci. USA</i> (2003) <b>100</b>:9440&ndash;9445.
      `);
    case 'bh-q-value':
      return(`
	The minimum False Discovery Rate (FDR) required to consider this match significant.</br>` + get_doc_text('bh-q-value-method', extra) + `
      `);
    case 'sdb-name':
      return(`
	The name of the (FASTA) sequence database file.
      `);
    case 'sdb-psp':
      return(`
	The name of the position specific priors (PSP) file.
      `);
    case 'sdb-dist':
      return(`
	The name of the binned distribution of priors file.
      `);
    case 'sdb-count':
      return(`
	The number of sequences in the database.
      `);
    case 'sdb-letters':
      return(`
	The number of letters in the sequence database.
      `);
    case 'lastmod':
      return(`
	The date of the last modification to the ` + extra + ` database.
      `);
    case 'sequence-id':
      return(`
        The identifier of the sequence (from the FASTA sequence header line)` + extra + `
      `);
    case 'sequence-name':
      return(`
	` + extra + `name of the sequence extracted from the sequence identifier (in the FASTA sequence header line).<br>
	When you use the <code>--parse-genomic--coord</code> option, the sequence name ends at the
	first colon ':' (if any) present in the sequence\'s FASTA identifier.  Typically this is the
	chromosome or contig name.  With the <code>--parse-genomic--coord</code> option,
	the start and stop positions are in 0-based coordinates relative to the sequence start given 
	in the FASTA sequence identifier (just after the sequence name).</td> </tr>
      `);
    case 'sequence-desc':
      return(`
        The description appearing after the identifier of the sequence in the FASTA header line.
      `);
    case 'sequence-name':
    case 'alph-name':
      return(`
	The name of the alphabet symbol.
      `);
    case 'alph-bg':
      return(`
	The frequency of the alphabet symbol as defined by the background model.
      `);
    case 'match-start-seq':
      return(`
	The start position of the ` + extra + `; 1-based sequence coordinates.
      `);
    case 'match-stop-seq':
      return(`
	The end position of the ` + extra + `; 1-based sequence coordinates.
      `);
    case 'match-start-genomic':
      return(`
	The start position of the ` + extra + `; genomic coordinates.
      `);
    case 'match-stop-genomic':
      return(`
	The end position of the ` + extra + `; genomic coordinates.
      `);
    case 'parse-genomic-coord':
      return(`
	` + extra + ` was run with the <code>--parse-genomic-coord</code> option
	and has split the sequence identifier into sequence name, sequence start and sequence end 
	in genomic coordinates.
      `);

    // AME
    case 'ame-pvalue':
      return(`
	The optimal enrichment <i>p</i>-value of the motif according to the statistical test;
	not adjusted for multiple tests.
      `);
    case 'ame-adj-pvalue':
      return(`
	The optimal enrichment <i>p</i>-value of the motif according to the statistical test,
        adjusted for multiple tests using a Bonferroni correction. ` + extra + `
	If the best <i>p</i>-value is <i>p</i> before adjustment,
        and the number of multiple tests is <i>n</i>, then the adjusted
        <i>p</i>-value is 1 - (1-<i>p</i>)<i><sup>n</sup></i>.
      `);
    case 'ame-evalue':
      return(`
	The expected number of motifs that would be as enriched in the
        (primary) sequences as this one.  The <i>E</i>-value is the adjusted <i>p</i>-value
        multiplied by the number of motifs in the motif file(s).
      `);

    // CentriMo
    case 'centrimo-adj-pvalue':
      return(`
        The statistical significance of the enrichment of the motif, adjusted for multiple tests. ` + extra + `
      `);
    case 'centrimo-evalue':
      var evalue_html = `
        at least one region as enriched for best matches to the motif as the reported region
	(or would have optimal average distance to the sequence center as low as observed, 
	if you used the <code>--cd</code> option).
      `;
      return(`
	The expected number motifs that would have ` + (extra ? extra : evalue_html) + `
	The <i>E</i>-value is the adjusted <i>p</i>-value multiplied by the number of motifs in the
	input files(s).</td> </tr>
      `);
    case 'centrimo-bin-width':
      return(`
        The width (in sequence positions) of the most enriched region (default),
        <b>or</b> two times the average distance between the center of the best site
        and the sequence center if you used the option <code>--cd</code>.
        A best match to the motif is counted as being in the region if
        the center of the motif falls in the region.
      `);
    case 'centrimo-sites-in-bin':
      return(`
	The number of (positive) sequences whose best match to the motif `
	+ (extra ? extra : "falls in the reported region (default) or anywhere in the sequence (if you used the option <code>--cd</code>).") + `
	<br>Note: This number may be less than the number of
	(positive) sequences that have a best match in the region.
	The reason for this is that a sequence may have many matches that score
	equally best.  If <i>n</i> matches have the best score in a sequence, 1/<i>n</i> is added to the
	appropriate bin for each match.</td> </tr>
      `);
    case 'centrimo-mult-tests':
      return(`
	This is the number of multiple tests (<i>n</i>) done for this motif.
	It was used to adjust the <i>p</i>-value of a region for
	multiple tests using the formula:
	<br>&nbsp;&nbsp;
	  <i>p</i>' = 1 - (1-<i>p</i>)<sup><i>n</i></sup> where <i>p</i> is the unadjusted <i>p</i>-value.
	<br>
	The number of multiple tests is the number of regions
	considered times the number of score thresholds considered.
	It depends on the motif length, sequence length, and the type of
	optimizations being done (central enrichment, local enrichment, central distance or
	score optimization).</td> </tr>
      `);

    // GOMo
    case 'gomo-go-term':
      return(`
        The Gene Ontology Consortium term for a specific role or locality.
        Used for annotating genes with their functions.
      `);
    case 'gomo-score':
      return( `
	A score generated as the <a href="https://en.wikipedia.org/wiki/Geometric_mean">
	geometric mean</a> of <a href="https://en.wikipedia.org/wiki/Mann-Whitney_U_test">rank-sum test(s)</a> 
	for the particular Gene Ontology term. The two groups compared by the rank-sum test are scores of genes annotated 
	with the GO term and scores of genes not annotated with the GO term.</td> </tr>
      `);
    case 'gomo-p-value':
      return( `
	An empirically generated <i>p</i>-value for the enrichment of the GO term.<br>
	The null hypothesis is that by shuffling the labels on gene scores, 
	any possible association between the set of genes that a GO term annotates is destroyed. 
	A large number of scores are generated using the null hypothesis and the number of null 
	hypothesis scores that are better than each of the real scores is summed and then divided 
	by the total null hypothesis scores generated to calculate a <i>p</i>-value.</td> </tr>
      `);

    // MAST

    // MCAST
    case 'mcast-cluster-score':
      return( `
        The score that the hidden Markov model created by MCAST assigned to the motif cluster.<br>
        This is the sum of the scores of the individual motif matches in the cluster, plus a
        gap penalty, <i>g</i>, multiplied by the total size of the inter-motif gaps
        in the cluster.  Individual motif match scores are log2(<i>P(s)/p</i>), where <i>s</i> is the 
        <a href="javascript:help_refine('pop_motif_match_score')">log-odds score</a> 
        of the motif match, <i>P(s)</i> is the 
        <a href="javascript:help_refine('pop_motif_match_pvalue')"><i>p</i>-value</a> 
	of the motif match, and <i>p</i> is the user-specified <i>p</i>-value threshold (default: 0.0005).
        <div class="active" id="pop_motif_match_score_act"></div>
        <div class="active" id="pop_motif_match_pvalue_act"></div>
      `);
    case 'mcast-cluster-p-value':
      return( `
	The <i>p</i>-value of the motif cluster score.<br>
	MCAST estimates <i>p</i>-values by fitting an exponential distribution
	to the observed motif cluster scores.
      `);
    case 'mcast-cluster-E-value':
      return( `
        The <i>E</i>-value of the motif cluster score.<br>
	The <i>E</i>-value is an estimate of the <i>number</i> of false positive matches
	with <i>p</i>-values at least as good as this match\'s.  
        MCAST estimates this by multiplying the motif cluster score <i>p</i>-value
        times the (estimated) number of random matches found in the search.
      `);

    // Tomtom
    case 'tomtom-offset':
      return( `
        The offset of the query motif relative to the target motif in the optimal alignment.<br>
 	A positive value indicates the query is shifted right.
      `);
    case 'tomtom-p-value':
      return( `
        The probability that a random motif of the same width as the target would have an 
	optimal alignment with a match score as good or better than the target's.<br>
	Tomtom estimates the <i>p</i>-value using a null model consisting of sampling
	motif columns from all the columns in the set of target motifs.
      `);
    case 'tomtom-E-value':
      return( `
	The expected number of false positives in the matches up to this point.<br>
	Tomtom estimates the <i>E</i>-value by multiplying the <i>p</i>-value by
	the total number of target motifs in all the target databases.
      `);
    case 'tomtom-overlap':
      return( `
	The number of motif columns that overlap in the optimal alignment.
      `);
    case 'tomtom-orientation':
      return( `
	The orientation of the target motif that gave the optimal alignment. ` + extra + `
      `);
  }

} // get_doc_text

//
// Function to replace the innerHTML of element "id" with an HTML paragraph
// containing the text for 'doc_type', which is known to function get_doc_text.
// This function can be used in help pop-ups.
//
function print_doc_para(id, doc_type, extra) {
  html = `<p>` + get_doc_text(doc_type, extra) + `</p>`; 
  document.getElementById(id).insertAdjacentHTML('beforeend', html);
} // print_doc_para
</script>
    <script>
function make_alpha_bg_table(alph, freqs) {
  function colour_symbol(index) {
    var span = document.createElement("span");
    span.appendChild(document.createTextNode(alph.get_symbol(index)));
    span.style.color = alph.get_colour(index);
    span.className = "alpha_symbol";
    return span;
  }
  var table, thead, tbody, row, th, span, i;
  // create table
  table = document.createElement("table");
  table.className = "alpha_bg_table";
  // create header
  thead = document.createElement("thead");
  table.appendChild(thead);
  row = thead.insertRow(thead.rows.length);
  if (alph.has_complement()) {
    add_text_header_cell(row, "Name", "pop_alph_name");
    if (freqs != null) add_text_header_cell(row, "Freq.", "pop_alph_freq");
    if (alph.has_bg()) add_text_header_cell(row, "Bg.", "pop_alph_bg");
    add_text_header_cell(row, "");
    add_text_header_cell(row, "");
    add_text_header_cell(row, "");
    if (alph.has_bg()) add_text_header_cell(row, "Bg.", "pop_alph_bg");
    if (freqs != null) add_text_header_cell(row, "Freq.", "pop_alph_freq");
    add_text_header_cell(row, "Name", "pop_alph_name");
  } else {
    add_text_header_cell(row, "");
    add_text_header_cell(row, "Name", "pop_alph_name");
    if (freqs != null) add_text_header_cell(row, "Freq.", "pop_alph_freq");
    if (alph.has_bg()) add_text_header_cell(row, "Bg.", "pop_alph_bg");
  }
  // add alphabet entries
  tbody = document.createElement("tbody");
  table.appendChild(tbody);
  if (alph.has_complement()) {
    for (i = 0; i < alph.get_size_core(); i++) {
      var c = alph.get_complement(i);
      if (i > c) continue;
      row = tbody.insertRow(tbody.rows.length);
      add_text_cell(row, alph.get_name(i));
      if (freqs != null) add_text_cell(row, "" + freqs[i]);
      if (alph.has_bg()) add_text_cell(row, "" + alph.get_bg_freq(i));
      add_cell(row, colour_symbol(i)); 
      add_text_cell(row, "~");
      add_cell(row, colour_symbol(c)); 
      if (alph.has_bg()) add_text_cell(row, "" + alph.get_bg_freq(c));
      if (freqs != null) add_text_cell(row, "" + freqs[c]);
      add_text_cell(row, alph.get_name(c));
    }
  } else {
    for (i = 0; i < alph.get_size_core(); i++) {
      row = tbody.insertRow(tbody.rows.length);
      add_cell(row, colour_symbol(i)); 
      add_text_cell(row, alph.get_name(i));
      if (freqs != null) add_text_cell(row, "" + freqs[i]);
      if (alph.has_bg()) add_text_cell(row, "" + alph.get_bg_freq(i));
    }
  }
  return table;
}

</script>
    <script>
      // 
      // return true if any part of the passed element is visible in the viewport
      //
      function element_in_viewport(elem) {
        var rect;
        try {
          rect = elem.getBoundingClientRect();
        } catch (e) {
          return false;
        }
        return (
            rect.top < (window.innerHeight || document.body.clientHeight) &&
            rect.bottom > 0 &&
            rect.left < (window.innerWidth || document.body.clientWidth) &&
            rect.right > 0
            );
      }

      //
      // Functions to delay a drawing task until it is required or it would not lag the display to do so
      //

      // a list of items still to be drawn
      var drawable_list = [];
      // the delay between drawing objects that are not currently visible
      var draw_delay = 1;
      // the delay after a user interaction
      var user_delay = 300;
      // the delay after a user has stopped scrolling and is viewing the stuff drawn on the current page
      var stop_delay = 300;
      // the timer handle; allows resetting of the timer after user interactions
      var draw_timer = null;

      //
      // Drawable
      //
      // elem - a page element which defines the position on the page that drawing is to be done
      // task - an object with the method run which takes care of painting the object
      //
      var Drawable = function(elem, task) {
        this.elem = elem;
        this.task = task;
      }

      //
      // Drawable.is_visible
      //
      // Determines if the element is visible in the viewport
      //
      Drawable.prototype.is_visible = function() {
        return element_in_viewport(this.elem);
      }

      //
      // Drawable.run
      //
      // Run the task held by the drawable
      Drawable.prototype.run = function() {
        if (this.task) this.task.run();
        this.task = null;
      }

      //
      // Drawable.run
      //
      // Run the task iff visible
      // returns true if the task ran or has already run
      Drawable.prototype.run_visible = function() {
        if (this.task) {
          if (element_in_viewport(this.elem)) {
            this.task.run();
            this.task = null;
            return true;
          }
          return false;
        } else {
          return true;
        }
      }

      //
      // draw_on_screen
      //
      // Checks each drawable object and draws those on screen.
      //
      function draw_on_screen() {
        var found = false;
        for (var i = 0; i < drawable_list.length; i++) {
          if (drawable_list[i].run_visible()) {
            drawable_list.splice(i--, 1);
            found = true;
          }
        }
        return found;
      }

      //
      // process_draw_tasks
      //
      // Called on a delay to process the next available
      // draw task.
      //
      function process_draw_tasks() {
        var delay = draw_delay;
        draw_timer = null;
        if (drawable_list.length == 0) return; //no more tasks
        if (draw_on_screen()) {
          delay = stop_delay; //give the user a chance to scroll
        } else {
          //get next task
          var drawable = drawable_list.shift();
          drawable.task.run();
        }
        //allow UI updates between tasks
        draw_timer = window.setTimeout("process_draw_tasks()", delay);
      }

      //
      // delayed_process_draw_tasks
      //
      // Call process_draw_tasks after a short delay.
      // The delay serves to group multiple redundant events.       
      // Should be set as event handler for onscroll and onresize.
      //
      function delayed_process_draw_tasks() {
        //reset the timer
        if (drawable_list.length > 0) { 
          if (draw_timer != null) clearTimeout(draw_timer);
          draw_timer = window.setTimeout("process_draw_tasks()", user_delay);
        }
      }

      //
      // add_draw_task
      //
      // Add a drawing task to be called immediately if it is
      // visible, or to be called on a delay to reduce stuttering
      // effect on the web browser.
      function add_draw_task(elem, task) {
        drawable = new Drawable(elem, task);
        if (drawable.is_visible()) {
          task.run();
        } else {
          drawable_list.push(drawable);
          //reset timer
          if (draw_timer != null) clearTimeout(draw_timer);
          draw_timer = window.setTimeout("process_draw_tasks()", user_delay);
        }
      }

</script>
    <script>
//======================================================================
// start Alphabet object
//======================================================================
var Alphabet = function(alphabet, background) {
  "use strict";
  var i, j, sym, aliases, complement, comp_e_sym, ambigs, generate_background;
  generate_background = (background == null);
  if (generate_background) {
    background = [];
    for (i = 0; i < alphabet.ncore; i++) background[i] = 1.0 / alphabet.ncore;
  } else if (alphabet.ncore != background.length) {
    throw new Error("The background length does not match the alphabet length.");
  }
  this.name = alphabet.name;
  this.like = (alphabet.like != null ? alphabet.like.toUpperCase() : null);
  this.ncore = alphabet.ncore;
  this.symbols = alphabet.symbols;
  this.background = background;
  this.genbg = generate_background;
  this.encode = {};
  this.encode2core = {};
  this.complement = {};
  // check if all symbols are same case
  var seen_uc = false;
  var seen_lc = false;
  var check_case = function (syms) {
    var s, sym;
    if (typeof syms === "string") {
      for (s = 0; s < syms.length; s++) {
        sym = syms.charAt(s);
        if (sym >= 'a' && sym <= 'z') seen_lc = true;
        else if (sym >= 'A' && sym <= 'Z') seen_uc = true;
      }
    }
  };
  for (i = 0; i < this.symbols.length; i++) {
    check_case(this.symbols[i].symbol);
    check_case(this.symbols[i].aliases);
  }
  // now map symbols to indexes
  var update_array = function(array, syms, index) {
    var s, sym;
    if (typeof syms === "string") {
      for (s = 0; s < syms.length; s++) {
        sym = syms.charAt(s);
        array[sym] = index;
        // when only a single case is used, then encode as case insensitive
        if (seen_uc != seen_lc) {
          if (sym >= 'a' && sym <= 'z') {
            array[sym.toUpperCase()] = index;
          } else if (sym >= 'A' && sym <= 'Z') {
            array[sym.toLowerCase()] = index;
          }
        }
      }
    }
  }
  // map core symbols to index
  for (i = 0; i < this.ncore; i++) {
    update_array(this.encode2core, this.symbols[i].symbol, i);
    update_array(this.encode, this.symbols[i].symbol, i);
    update_array(this.encode2core, this.symbols[i].aliases, i);
    update_array(this.encode, this.symbols[i].aliases, i);
  }
  // map ambiguous symbols to index
  ambigs = {};
  for (i = this.ncore; i < this.symbols.length; i++) {
    update_array(this.encode, this.symbols[i].symbol, i);
    update_array(this.encode, this.symbols[i].aliases, i);
    ambigs[this.symbols[i].equals] = i;
  }
  // determine complements
  for (i = 0; i < this.ncore; i++) {
    complement = this.symbols[i].complement;
    if (typeof complement === "string") {
      this.complement[i] = this.encode2core[complement];
    }
  }
  next_symbol:
  for (i = this.ncore; i < this.symbols.length; i++) {
    complement = "";
    for (j = 0; j < this.symbols[i].equals.length; j++) {
      comp_e_sym = this.complement[this.encode2core[this.symbols[i].equals.charAt(j)]];
      if (typeof comp_e_sym !== "number") continue next_symbol;
      complement += this.symbols[comp_e_sym].symbol;
    }
    complement = complement.split("").sort().join("");
    if (typeof ambigs[complement] === "number") {
      this.complement[i] = ambigs[complement];
    }
  }
  // determine case insensitivity
  this.case_insensitive = true;
  if (seen_uc == seen_lc) {
    // when there is a mixture of cases it probably won't
    // be case insensitive but we still need to check
    loop:
    for (i = 0; i < this.symbols.length; i++) {
      sym = this.symbols[i].symbol;
      if (sym >= 'A' && sym <= 'Z') {
        if (this.encode[sym.toLowerCase()] != i) {
          this.case_insensitive = false;
          break loop;
        }
      } else if (sym >= 'a' && sym <= 'z') {
        if (this.encode[sym.toUpperCase()] != i) {
          this.case_insensitive = false;
          break loop;
        }
      }
      aliases = this.symbols[i].aliases;
      if (aliases != null) {
        for (j = 0; j < aliases.length; j++) {
          sym = aliases.charAt(j);
          if (sym >= 'A' && sym <= 'Z') {
            if (this.encode[sym.toLowerCase()] != i) {
              this.case_insensitive = false;
              break loop;
            }
          } else if (sym >= 'a' && sym <= 'z') {
            if (this.encode[sym.toUpperCase()] != i) {
              this.case_insensitive = false;
              break loop;
            }
          }
        }
      }
    }
  }
  // normalise aliases to remove the prime symbol and eliminate
  // the alternate cases when the alphabet is case insensitive
  var seen, out;
  for (i = 0; i < this.symbols.length; i++) {
    sym = this.symbols[i].symbol;
    aliases = this.symbols[i].aliases;
    if (typeof aliases != "string") aliases = "";
    seen = {};
    out = [];
    if (this.case_insensitive) {
      sym = sym.toUpperCase();
      aliases = aliases.toUpperCase();
    }
    seen[sym] = true;
    for (j = 0; j < aliases.length; j++) {
      if (!seen[aliases.charAt(j)]) {
        seen[aliases.charAt(j)] = true;
        out.push(aliases.charAt(j));
      }
    }
    this.symbols[i].aliases = out.sort().join("");
  }
};
// return the name of the alphabet
Alphabet.prototype.get_alphabet_name = function() {
  return this.name;
};
// return if the alphabet can be complemented
Alphabet.prototype.has_complement = function() {
  return (typeof this.symbols[0].complement === "string");
};
// return true if an uppercase letter has the same meaning as the lowercase form
Alphabet.prototype.is_case_insensitive = function() {
  return this.case_insensitive;
};
// return the information content of an alphabet letter
Alphabet.prototype.get_ic = function() {
  return Math.log(this.ncore) / Math.LN2;
};
// return the count of the core alphabet symbols
Alphabet.prototype.get_size_core = function() {
  return this.ncore;
};
// return the count of all alphabet symbols
Alphabet.prototype.get_size_full = function() {
  return this.symbols.length;
};
// return the symbol for the given alphabet index
Alphabet.prototype.get_symbol = function(alph_index) {
  "use strict";
  if (alph_index < 0 || alph_index >= this.symbols.length) {
    throw new Error("Alphabet index out of bounds");
  }
  return this.symbols[alph_index].symbol;
};
// return the aliases for the given alphabet index
Alphabet.prototype.get_aliases = function(alph_index) {
  "use strict";
  if (alph_index < 0 || alph_index >= this.symbols.length) {
    throw new Error("Alphabet index out of bounds");
  }
  var sym_obj = this.symbols[alph_index];
  return (sym_obj.aliases != null ? sym_obj.aliases : "");
};
// return the name for the given alphabet index
Alphabet.prototype.get_name = function(alph_index) {
  "use strict";
  var sym;
  if (alph_index < 0 || alph_index >= this.symbols.length) {
    throw new Error("Alphabet index out of bounds");
  }
  sym = this.symbols[alph_index];
  return (typeof sym.name === "string" ? sym.name : sym.symbol);
};
// return the alphabet it is like or null
Alphabet.prototype.get_like = function() {
  "use strict";
  return this.like;
};
// return the index of the complement for the given alphabet index
Alphabet.prototype.get_complement = function(alph_index) {
  var comp_e_sym = this.complement[alph_index];
  if (typeof comp_e_sym === "number") {
    return comp_e_sym;
  } else {
    return -1;
  }
};
// return a string containing the core symbols
Alphabet.prototype.get_symbols = function() {
  "use strict";
  var i, core_symbols;
  core_symbols = "";
  for (i = 0; i < this.ncore; i++) {
    core_symbols += this.symbols[i].symbol;
  }
  return core_symbols;
};
// return if the background was not a uniform generated background
Alphabet.prototype.has_bg = function() {
  "use strict";
  return !this.genbg;
};
// get the background frequency for the index
Alphabet.prototype.get_bg_freq = function(alph_index) {
  "use strict";
  var freq, i, symbols;
  if (alph_index >= 0) {
    if (alph_index < this.ncore) {
      return this.background[alph_index];
    } else if (alph_index < this.symbols.length) {
      freq = 0;
      symbols = this.symbols[alph_index].equals;
      for (i = 0; i < symbols.length; i++) {
        freq += this.background[this.encode2core[symbols.charAt(i)]];
      }
      return freq;
    } 
  }
  throw new Error("The alphabet index is out of range.");
};
// get the colour of the index
Alphabet.prototype.get_colour = function(alph_index) {
  "use strict";
  if (alph_index < 0 || alph_index >= this.symbols.length) {
    throw new Error("BAD_ALPHABET_INDEX");
  }
  if (typeof this.symbols[alph_index].colour != "string") {
    return "black";
  }
  return "#" + this.symbols[alph_index].colour;
};
// get the rgb components of the colour at the index
Alphabet.prototype.get_rgb = function(alph_index) {
  "use strict";
  if (alph_index < 0 || alph_index >= this.symbols.length) {
    throw new Error("BAD_ALPHABET_INDEX");
  }
  if (typeof this.symbols[alph_index].colour != "string") {
    return {"red": 0, "green": 0, "blue": 0};
  }
  var colour = this.symbols[alph_index].colour;
  var red = parseInt(colour.substr(0, 2), 16) / 255;
  var green = parseInt(colour.substr(2, 2), 16) / 255;
  var blue = parseInt(colour.substr(4, 2), 16) / 255;
  return {"red": red, "green": green, "blue": blue};
};
// convert a symbol into the index
Alphabet.prototype.get_index = function(letter) {
  "use strict";
  var alph_index;
  alph_index = this.encode[letter];
  if (typeof alph_index === "undefined") {
    return -1;
  }
  return alph_index;
};
// convert a symbol into the list of core indexes that it equals
Alphabet.prototype.get_indexes = function(letter) {
  "use strict";
  var alph_index, comprise_str, i, comprise_list;
  alph_index = this.encode[letter];
  if (typeof alph_index === "undefined") {
    throw new Error("Unknown letter");
  }
  comprise_str = this.symbols[alph_index].equals;
  comprise_list = [];
  if (typeof comprise_str == "string") {
    for (i = 0; i < comprise_str.length; i++) {
      comprise_list.push(this.encode2core[comprise_str.charAt(i)]);
    }
  } else {
    comprise_list.push(alph_index);
  }
  return comprise_list;
};
// check if a symbol is the primary way of representing the symbol in the alphabet
Alphabet.prototype.is_prime_symbol = function(letter) {
  var alph_index;
  alph_index = this.encode[letter];
  if (alph_index == null) return false;
  if (this.is_case_insensitive()) {
    return (this.symbols[alph_index].symbol.toUpperCase() == letter.toUpperCase());
  } else {
    return (this.symbols[alph_index].symbol == letter);
  }
};
// compare 2 alphabets
Alphabet.prototype.equals = function(other) {
  "use strict";
  var i, sym1, sym2;
  // first check that it's actually an alphabet object
  if (!(typeof other === "object" && other != null && other instanceof Alphabet)) {
    return false;
  }
  // second shortcircuit if it's the same object
  if (this === other) return true;
  // compare
  if (this.name !== other.name) return false;
  if (this.ncore !== other.ncore) return false;
  if (this.symbols.length !== other.symbols.length) return false;
  for (i = 0; i < this.symbols.length; i++) {
    sym1 = this.symbols[i];
    sym2 = other.symbols[i];
    if (sym1.symbol !== sym2.symbol) return false;
    if (sym1.aliases !== sym2.aliases) return false;
    if (sym1.name !== sym2.name) return false;
    if (typeof sym1.colour !== typeof sym2.colour || 
        (typeof sym1.colour === "string" && typeof sym2.colour === "string" &&
         parseInt(sym1.colour, 16) != parseInt(sym2.colour, 16))) {
      return false;
    }
    if (sym1.complement !== sym2.complement) return false;
    if (sym1.equals !== sym2.equals) return false;
  }
  return true;
};
Alphabet.prototype.check_core_subset = function(super_alph) {
  var complement_same = true;
  var seen_set = {};
  var sub_i, sub_symbol, super_i, super_symbol;
  for (sub_i = 0; sub_i < this.ncore; sub_i++) {
    sub_symbol = this.symbols[sub_i];
    super_i = super_alph.encode[sub_symbol.symbol]; 
    if (super_i == null) return 0;
    super_symbol = super_alph.symbols[super_i];
    if (seen_set[super_i]) return 0;
    seen_set[super_i] = true;
    // check complement
    if (sub_symbol.complement != null && super_symbol.complement != null) {
      if (super_alph.encode[sub_symbol.complement] != super_alph.encode[super_symbol.complement]) {
        complement_same = false;
      }
    } else if (sub_symbol.complement != null || super_symbol.complement != null) {
      complement_same = false;
    }
  }
  return (complement_same ? 1 : -1);
};
// convert a sequence to its reverse complement
Alphabet.prototype.invcomp_seq = function(seq) {
  "use strict";
  var syms, i, e_sym, comp_e_sym;
  if (!this.has_complement()) throw new Error("Alphabet must be complementable");
  syms = seq.split("");
  for (i = 0; i < syms.length; i++) {
    e_sym = this.encode[syms[i]];
    if (typeof e_sym === "undefined") {
      e_sym = this.ncore; // wildcard
    }
    comp_e_sym = this.complement[e_sym];
    if (typeof comp_e_sym === "undefined") {
      comp_e_sym = e_sym; // not complementable
    }
    syms[i] = this.symbols[comp_e_sym].symbol;
  }
  return syms.reverse().join("");
};
// convert the alphabet to the text version
Alphabet.prototype.as_text = function() {
  "use strict";
  function name_as_text(name) {
    var i, c, out;
    out = "\"";
    for (i = 0; i < name.length; i++) {
      c = name.charAt(i);
      if (c == "\"") {
        out += "\\\"";
      } else if (c == "/") {
        out += "\\/";
      } else if (c == "\\") {
        out += "\\\\";
      } else {
        out += c;
      }
    }
    out += "\"";
    return out;
  }
  function symbol_as_text(sym) {
    var out;
    out = sym.symbol;
    if (typeof sym.name === "string" && sym.name != sym.symbol) {
      out += " " + name_as_text(sym.name);
    }
    if (typeof sym.colour === "string") {
      out += " " + sym.colour;
    }
    return out;
  }
  var out, i, j, c, sym;
  out = "";
  // output core symbols with 2 way complements
  for (i = 0; i < this.ncore; i++) {
    c = this.complement[i];
    if (typeof c === "number" && i < c && this.complement[c] === i) {
      out += symbol_as_text(this.symbols[i]) + " ~ " + symbol_as_text(this.symbols[c]) + "\n";  
    }
  }
  // output core symbols with no complement
  for (i = 0; i < this.ncore; i++) {
    if (typeof this.complement[i] === "undefined") {
      out += symbol_as_text(this.symbols[i]) + "\n";
    }
  }
  // output ambiguous symbols that have comprising characters
  for (i = this.ncore; i < this.symbols.length; i++) {
    if (this.symbols[i].equals.length == 0) break;
    out += symbol_as_text(this.symbols[i]) + " = " + this.symbols[i].equals + "\n";
    if (typeof this.symbols[i].aliases === "string") {
      for (j = 0; j < this.symbols[i].aliases.length; j++) {
        if (this.symbols[i].aliases.charAt(j) == this.symbols[i].symbol) continue;
        out += this.symbols[i].aliases.charAt(j) + " = " + this.symbols[i].equals + "\n";
      }
    }
  }
  // output aliases of core symbols
  for (i = 0; i < this.ncore; i++) {
    if (typeof this.symbols[i].aliases === "string") {
      for (j = 0; j < this.symbols[i].aliases.length; j++) {
        if (this.symbols[i].aliases.charAt(j) == this.symbols[i].symbol) continue;
        out += this.symbols[i].aliases.charAt(j) + " = " + this.symbols[i].symbol + "\n";
      }
    }
  }
  // output gap symbols
  i = this.symbols.length - 1;
  if (this.symbols[i].equals.length == 0) {
    out += symbol_as_text(this.symbols[i]) + " =\n";
    if (typeof this.symbols[i].aliases === "string") {
      for (j = 0; j < this.symbols[i].aliases.length; j++) {
        if (this.symbols[i].aliases.charAt(j) == this.symbols[i].symbol) continue;
        out += this.symbols[i].aliases.charAt(j) + " =\n";
      }
    }
  }
  return out;
};
// output the alphabet as it appears in minimal MEME format
Alphabet.prototype.as_meme = function() {
  "use strict";
  function name_as_text(name) {
    var i, c, out;
    out = "\"";
    for (i = 0; i < name.length; i++) {
      c = name.charAt(i);
      if (c == "\"") {
        out += "\\\"";
      } else if (c == "/") {
        out += "\\/";
      } else if (c == "\\") {
        out += "\\\\";
      } else {
        out += c;
      }
    }
    out += "\"";
    return out;
  }
  if (this.equals(AlphStd.DNA)) {
    return "ALPHABET= ACGT\n";
  } else if (this.equals(AlphStd.PROTEIN)) {
    return "ALPHABET= ACDEFGHIKLMNPQRSTVWY\n";
  } else {
    return "ALPHABET" + 
      (this.name != null ? " " + name_as_text(this.name) : "") + 
      (this.like != null ? " " + this.like + "-LIKE" : "") + "\n" +
      this.as_text() + "END ALPHABET\n";
  }
};

// Returns a table showing all the letters in the alphabet
Alphabet.prototype.as_table = function() {
  "use strict";
  var i, j, row, th, td, aliases, equals, sym;
  var table = document.createElement("table");
  // create the core symbol header
  row = table.insertRow(table.rows.length);
  th = document.createElement("th");
  th.appendChild(document.createTextNode("Symbol(s)"));
  row.appendChild(th);
  th = document.createElement("th");
  th.appendChild(document.createTextNode("Name"));
  row.appendChild(th);
  th = document.createElement("th");
  if (this.has_complement()) {
    th.appendChild(document.createTextNode("Complement"));
  }
  row.appendChild(th);
  // list the core symbols
  for (i = 0; i < this.ncore; i++) {
    row = table.insertRow(table.rows.length);
    td = document.createElement("td");
    if (this.symbols[i].colour != null) {
      td.style.color = '#' + this.symbols[i].colour;
    }
    td.appendChild(document.createTextNode(this.symbols[i].symbol));
    aliases = this.get_aliases(i);
    if (aliases.length > 0) {
      td.appendChild(document.createTextNode(' ' + aliases.split('').join(' ')));
    }
    row.appendChild(td);
    td = document.createElement("td");
    if (this.symbols[i].name != null) {
      td.appendChild(document.createTextNode(this.symbols[i].name));
    }
    row.appendChild(td);
    td = document.createElement("td");
    if (this.symbols[i].complement != null) {
      td.style.color = this.get_colour(this.get_index(this.symbols[i].complement));
      td.appendChild(document.createTextNode(this.symbols[i].complement));
    }
    row.appendChild(td);
  }
  // create the ambiguous symbol header
  row = table.insertRow(table.rows.length);
  th = document.createElement("th");
  th.appendChild(document.createTextNode("Symbol(s)"));
  row.appendChild(th);
  th = document.createElement("th");
  th.appendChild(document.createTextNode("Name"));
  row.appendChild(th);
  th = document.createElement("th");
  th.appendChild(document.createTextNode("Matches"));
  row.appendChild(th);
  // list the ambiguous symbols
  for (i = this.ncore; i < this.symbols.length; i++) {
    row = table.insertRow(table.rows.length);
    td = document.createElement("td");
    if (this.symbols[i].colour != null) {
      td.style.color = '#' + this.symbols[i].colour;
    }
    td.appendChild(document.createTextNode(this.symbols[i].symbol));
    aliases = this.get_aliases(i);
    if (aliases.length > 0) {
      td.appendChild(document.createTextNode(' ' + aliases.split('').join(' ')));
    }
    row.appendChild(td);
    td = document.createElement("td");
    if (this.symbols[i].name != null) {
      td.appendChild(document.createTextNode(this.symbols[i].name));
    }
    row.appendChild(td);
    td = document.createElement("td");
    equals = this.symbols[i].equals.split('');
    for (j = 0; j < equals.length; j++) {
      if (j != 0) td.appendChild(document.createTextNode(' '));
      sym = document.createElement("span");
      sym.style.color = this.get_colour(this.get_index(equals[j]));
      sym.appendChild(document.createTextNode(equals[j]));
      td.appendChild(sym);
    }
    row.appendChild(td);
  }
  return table;
};

// returns a dictionary of the colours for EPS
Alphabet.prototype._as_eps_dict = function() {
  "use strict";
  var i, sym, rgb;
  var out = "/fullColourDict <<\n";
  for (i = 0; i < this.ncore; i++) {
    sym = this.get_symbol(i);
    sym = sym.replace(/\\/g, "\\\\");
    sym = sym.replace(/\(/g, "\\(");
    sym = sym.replace(/\)/g, "\\)");
    rgb = this.get_rgb(i);
    out += " (" + sym + ") [" + rgb.red.toFixed(4) + " " + rgb.green.toFixed(4) + " " + rgb.blue.toFixed(4) + "]\n";
  }
  out += ">> def\n";
  out += "/mutedColourDict <<\n";
  for (i = 0; i < this.ncore; i++) {
    sym = this.get_symbol(i);
    sym = sym.replace(/\\/g, "\\\\");
    sym = sym.replace(/\(/g, "\\(");
    sym = sym.replace(/\)/g, "\\)");
    rgb = Alphabet.lighten_colour(this.get_rgb(i));
    out += " (" + sym + ") [" + rgb.red.toFixed(4) + " " + rgb.green.toFixed(4) + " " + rgb.blue.toFixed(4) + "]\n";
  }
  out += ">> def\n";
  return out;
};

// return the alphabet name or a list of primary symbols
Alphabet.prototype.toString = function() {
  "use strict";
  if (this.name != null) {
    return this.name;
  } else {
    return this.get_symbols();
  }
};

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Helper functions
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

// Convert a colour specified in RGB colourspace values into LAB colourspace
Alphabet.rgb2lab = function(rgb) {
  "use strict";
  var xyzHelper, labHelper;
  // XYZ helper
  xyzHelper = function(value) {
    if (value > 0.0445) {
      value = (value + 0.055) / 1.055;
      value = Math.pow(value, 2.4);
    } else {
      value /= 12.92;
    }
    value *= 100;
    return value;
  };
  // lab helper
  labHelper = function(value) {
    if (value > 0.008856) {
      value = Math.pow(value, 1.0 / 3.0);
    } else {
      value = (7.787 * value) + (16.0 / 116.0);
    }
    return value;
  };
  // convert into XYZ colourspace
  var c1, c2, c3;
  if (typeof rgb == "number") {
    c1 = xyzHelper(((rgb >> 16) & 0xFF) / 255.0);
    c2 = xyzHelper(((rgb >> 8) & 0xFF) / 255.0);
    c3 = xyzHelper((rgb & 0xFF) / 255.0);
  } else {
    c1 = xyzHelper(rgb.red);
    c2 = xyzHelper(rgb.green);
    c3 = xyzHelper(rgb.blue);
  }
  var x = (c1 * 0.4124) + (c2 * 0.3576) + (c3 * 0.1805);
  var y = (c1 * 0.2126) + (c2 * 0.7152) + (c3 * 0.0722);
  var z = (c1 * 0.0193) + (c2 * 0.1192) + (c3 * 0.9505);
  // convert into Lab colourspace
  c1 = labHelper(x / 95.047);
  c2 = labHelper(y / 100.0);
  c3 = labHelper(z / 108.883);
  var l = (116.0 * c2) - 16;
  var a = 500.0 * (c1 - c2);
  var b = 200.0 * (c2 - c3);
  return {"l": l, "a": a, "b": b};
};

// Convert a colour specified in HSV colourspace into RGB colourspace
Alphabet.hsv2rgb = function(hue, sat, value, output_object) {
  // achromatic (grey)
  var r = value;
  var g = value;
  var b = value;
  if (sat != 0) {
    var h = hue / 60.0;
    var i = Math.floor(h);
    var f = h - i;
    var p = value * (1.0 - sat);
    var q = value * (1.0 - (sat * f));
    var t = value * (1.0 - (sat * (1.0 - f)));
    if (i == 0) {
      r = value;
      g = t;
      b = p;
    } else if (i == 1) {
      r = q;
      g = value;
      b = p;
    } else if (i == 2) {
      r = p;
      g = value;
      b = t;
    } else if (i == 3) {
      r = p;
      g = q;
      b = value;
    } else if (i == 4) {
      r = t;
      g = p;
      b = value;
    } else {
      r = value;
      g = p;
      b = q;
    }
  }
  if (output_object) {
    return {"red": r, "green": g, "blue": b};
  } else {
    return (Math.floor(r * 255) << 15) | (Math.floor(g * 255) << 8) | (Math.floor(b * 255));
  }
};

// Calculate a distance score between two colours in LAB colourspace
Alphabet.lab_dist = function(lab1, lab2) {
  var c1 = Math.sqrt((lab1.l * lab1.l) + (lab1.a * lab1.a));
  var c2 = Math.sqrt((lab2.l * lab2.l) + (lab2.a * lab2.a));
  var dc = c1 - c2;
  var dl = lab1.l - lab2.l;
  var da = lab1.a - lab2.a;
  var db = lab1.b - lab2.b;
  // we don't want NaN due to rounding errors so fudge things a bit...
  var dh = 0;
  var dh_squared = (da * da) + (db * db) - (dc * dc);
  if (dh_squared > 0) {
    dh = Math.sqrt(dh_squared);
  }
  var first = dl;
  var second = dc / (1.0 + (0.045 * c1));
  var third = dh / (1.0 + (0.015 * c1));
  return Math.sqrt((first * first) + (second * second) + (third * third));
};

// convert an RGB value into a HSL value
Alphabet.rgb2hsl = function(rgb) {
  "use strict";
  var min, max, delta, h, s, l, r, g, b;
  if (typeof rgb == "number") {
    r = ((rgb >> 16) & 0xFF) / 255.0;
    g = ((rgb >> 8) & 0xFF) / 255.0;
    b = (rgb & 0xFF) / 255.0;
  } else {
    r = rgb.red;
    g = rgb.green;
    b = rgb.blue;
  }
  min = Math.min(r, g, b);
  max = Math.max(r, g, b);
  delta = max - min;
  l = min + (delta / 2);
  if (max == min) {
    h = 0; // achromatic (grayscale)
    s = 0;
  } else {
    if (l > 0.5) {
      s = delta / (2 - max - min);
    } else {
      s = delta / (max + min);
    }
    if (max == r) {
      h = (g - b) / delta;
      if (g < b) h += 6;
    } else if (max == g) {
      h = ((b - r) / delta) + 2;
    } else {
      h = ((r - g) / delta) + 4;
    }
    h /= 6;
  }
  return {"h": h, "s": s, "l": l};
};

// convert a HSL value into an RGB value
Alphabet.hsl2rgb = function(hsl, output_object) {
  "use strict";
  function _hue(p, q, t) {
    "use strict";
    if (t < 0) t += 1;
    else if (t > 1) t -= 1;
    if (t < (1.0 / 6.0)) {
      return p + ((q - p) * 6.0 * t);
    } else if (t < 0.5) {
      return q;
    } else if (t < (2.0 / 3.0)) {
      return p + ((q - p) * ((2.0 / 3.0) - t) * 6.0);
    } else {
      return p;
    }
  }
  var r, g, b, p, q;
  if (hsl.s == 0) {
    // achromatic (grayscale)
    r = hsl.l;
    g = hsl.l;
    b = hsl.l;
  } else {
    if (hsl.l < 0.5) {
      q = hsl.l * (1 + hsl.s);
    } else {
      q = hsl.l + hsl.s - (hsl.l * hsl.s);
    }
    p = (2 * hsl.l) - q;
    r = _hue(p, q, hsl.h + (1.0 / 3.0));
    g = _hue(p, q, hsl.h);
    b = _hue(p, q, hsl.h - (1.0 / 3.0));
  }
  if (output_object) {
    return {"red": r, "green": g, "blue": b};
  } else {
    return (Math.floor(r * 255) << 15) | (Math.floor(g * 255) << 8) | (Math.floor(b * 255));
  }
};

Alphabet.lighten_colour = function(rgb) {
  "use strict";
  var hsl = Alphabet.rgb2hsl(rgb);
  hsl.l += (1.0 - hsl.l) * 2 / 3;
  return Alphabet.hsl2rgb(hsl, typeof rgb != "number");
};

//======================================================================
// end Alphabet object
//======================================================================

//======================================================================
// start StandardAlphabet object
//======================================================================

// an extension of the alphabet object to support some additional fields 
// only present in standard alphabets.
var StandardAlphabet = function(enum_code, enum_name, alphabet_data) {
  Alphabet.apply(this, [alphabet_data]);
  this.enum_code = enum_code;
  this.enum_name = enum_name;
};
StandardAlphabet.prototype = Alphabet.prototype;
StandardAlphabet.prototype.constructor = StandardAlphabet;

// A unique code for this standard alphabet.
// This code will be a power of 2 to enable creation of bitsets for
// a selection of standard alphabets.
StandardAlphabet.prototype.get_code = function() {
  return this.enum_code;
};

// A unique name for this standard alphabet.
// this name will be all upper case and the same as the property that
// refers to this alphabet in the AlphStd collection.
StandardAlphabet.prototype.get_enum = function() {
  return this.enum_name;
};

//======================================================================
// end StandardAlphabet object
//======================================================================

// A collection of standard alphabets.
var AlphStd = {
  RNA: new StandardAlphabet(1, "RNA", {
    "name": "RNA",
    "like": "RNA",
    "ncore": 4,
    "symbols": [
      {"symbol": "A", "name": "Adenine", "colour": "CC0000"},
      {"symbol": "C", "name": "Cytosine", "colour": "0000CC"},
      {"symbol": "G", "name": "Guanine", "colour": "FFB300"},
      {"symbol": "U", "name": "Uracil", "colour": "008000",
        "aliases": "T"},
      {"symbol": "N", "name": "Any base", "equals": "ACGU", "aliases": "X."},
      {"symbol": "V", "name": "Not U", "equals": "ACG"},
      {"symbol": "H", "name": "Not G", "equals": "ACU"},
      {"symbol": "D", "name": "Not C", "equals": "AGU"},
      {"symbol": "B", "name": "Not A", "equals": "CGU"},
      {"symbol": "M", "name": "Amino", "equals": "AC"},
      {"symbol": "R", "name": "Purine", "equals": "AG"},
      {"symbol": "W", "name": "Weak", "equals": "AU"}, 
      {"symbol": "S", "name": "Strong", "equals": "CG"},
      {"symbol": "Y", "name": "Pyrimidine", "equals": "CU"},
      {"symbol": "K", "name": "Keto", "equals": "GU"}
    ]
  }), 
  DNA: new StandardAlphabet(2, "DNA", {
    "name": "DNA",
    "like": "DNA",
    "ncore": 4,
    "symbols": [
      {"symbol": "A", "name": "Adenine", "colour": "CC0000", "complement": "T"},
      {"symbol": "C", "name": "Cytosine", "colour": "0000CC", "complement": "G"},
      {"symbol": "G", "name": "Guanine", "colour": "FFB300", "complement": "C"},
      {"symbol": "T", "name": "Thymine", "colour": "008000", "complement": "A",
        "aliases": "U"},
      {"symbol": "N", "name": "Any base", "equals": "ACGT", "aliases": "X."},
      {"symbol": "V", "name": "Not T", "equals": "ACG"},
      {"symbol": "H", "name": "Not G", "equals": "ACT"},
      {"symbol": "D", "name": "Not C", "equals": "AGT"},
      {"symbol": "B", "name": "Not A", "equals": "CGT"},
      {"symbol": "M", "name": "Amino", "equals": "AC"},
      {"symbol": "R", "name": "Purine", "equals": "AG"},
      {"symbol": "W", "name": "Weak", "equals": "AT"}, 
      {"symbol": "S", "name": "Strong", "equals": "CG"},
      {"symbol": "Y", "name": "Pyrimidine", "equals": "CT"},
      {"symbol": "K", "name": "Keto", "equals": "GT"}
    ]
  }), 
  PROTEIN: new StandardAlphabet(4, "PROTEIN", {
    "name": "Protein",
    "like": "PROTEIN",
    "ncore": 20,
    "symbols": [
      {"symbol": "A", "name": "Alanine", "colour": "0000CC"},
      {"symbol": "C", "name": "Cysteine", "colour": "0000CC"},
      {"symbol": "D", "name": "Aspartic acid", "colour": "FF00FF"},
      {"symbol": "E", "name": "Glutamic acid", "colour": "FF00FF"},
      {"symbol": "F", "name": "Phenylalanine", "colour": "0000CC"},
      {"symbol": "G", "name": "Glycine", "colour": "FFB300"},
      {"symbol": "H", "name": "Histidine", "colour": "FFCCCC"},
      {"symbol": "I", "name": "Isoleucine", "colour": "0000CC"},
      {"symbol": "K", "name": "Lysine", "colour": "CC0000"},
      {"symbol": "L", "name": "Leucine", "colour": "0000CC"},
      {"symbol": "M", "name": "Methionine", "colour": "0000CC"},
      {"symbol": "N", "name": "Asparagine", "colour": "008000"},
      {"symbol": "P", "name": "Proline", "colour": "FFFF00"},
      {"symbol": "Q", "name": "Glutamine", "colour": "008000"},
      {"symbol": "R", "name": "Arginine", "colour": "CC0000"},
      {"symbol": "S", "name": "Serine", "colour": "008000"},
      {"symbol": "T", "name": "Threonine", "colour": "008000"},
      {"symbol": "V", "name": "Valine", "colour": "0000CC"},
      {"symbol": "W", "name": "Tryptophan", "colour": "0000CC"},
      {"symbol": "Y", "name": "Tyrosine", "colour": "33E6CC"},
      {"symbol": "X", "name": "Any amino acid", "equals": "ACDEFGHIKLMNPQRSTVWY", "aliases": "*."},
      {"symbol": "B", "name": "Asparagine or Aspartic acid", "equals": "DN"}, 
      {"symbol": "Z", "name": "Glutamine or Glutamic acid", "equals": "EQ"}, 
      {"symbol": "J", "name": "Leucine or Isoleucine", "equals": "IL"}
    ]
  })
};

//======================================================================
// start Symbol object
//======================================================================
var Symbol = function(alph_index, scale, alphabet) {
  "use strict";
  //variable prototype
  this.symbol = alphabet.get_symbol(alph_index);
  this.scale = scale;
  this.colour = alphabet.get_colour(alph_index);
};

Symbol.prototype.get_symbol = function() {
  "use strict";
  return this.symbol;
};

Symbol.prototype.get_scale = function() {
  "use strict";
  return this.scale;
};

Symbol.prototype.get_colour = function() {
  "use strict";
  return this.colour;
};

Symbol.prototype.toString = function() {
  "use strict";
  return this.symbol + " " + (Math.round(this.scale*1000)/10) + "%";
};

function compare_symbol(sym1, sym2) {
  "use strict";
  if (sym1.get_scale() < sym2.get_scale()) {
    return -1;
  } else if (sym1.get_scale() > sym2.get_scale()) {
    return 1;
  } else {
    return 0;
  }
}
//======================================================================
// end Symbol object
//======================================================================

//======================================================================
// start Pspm object
//======================================================================
var Pspm = function(matrix, name, ltrim, rtrim, nsites, evalue, pssm, alt) {
  "use strict";
  var row, col, data, row_sum, delta, evalue_re;
  if (typeof name !== "string") {
    name = "";
  }
  this.name = name;
  //construct
  if (matrix instanceof Pspm) {
    // copy constructor
    this.alph_length = matrix.alph_length;
    this.motif_length = matrix.motif_length;
    this.name = matrix.name;
    this.alt = matrix.alt;
    this.nsites = matrix.nsites;
    this.evalue = matrix.evalue;
    this.ltrim = matrix.ltrim;
    this.rtrim = matrix.rtrim;
    this.pspm = [];
    for (row = 0; row < matrix.motif_length; row++) {
      this.pspm[row] = [];
      for (col = 0; col < matrix.alph_length; col++) {
        this.pspm[row][col] = matrix.pspm[row][col];
      }
    }
    if (matrix.pssm != null) {
      this.pssm = [];
      for (row = 0; row < matrix.motif_length; row++) {
        this.pspm[row] = [];
        for (col = 0; col < matrix.alph_length; col++) {
          this.pssm[row][col] = matrix.pssm[row][col];
        }
      }
    }
  } else {
    // check parameters
    if (ltrim == null) {
      ltrim = 0;
    } else if (typeof ltrim !== "number" || ltrim % 1 !== 0 || ltrim < 0) {
      throw new Error("ltrim must be a non-negative integer, got: " + ltrim);
    }
    if (rtrim == null) {
      rtrim = 0;
    } else if (typeof rtrim !== "number" || rtrim % 1 !== 0 || rtrim < 0) {
      throw new Error("rtrim must be a non-negative integer, got: " + rtrim);
    }
    if (nsites != null) {
      if (typeof nsites !== "number" || nsites < 0) {
        throw new Error("nsites must be a positive number, got: " + nsites);
      } else if (nsites == 0) {
        nsites = null;
      }
    }
    if (evalue != null) {
      if (typeof evalue === "number") {
        if (evalue < 0) {
          throw new Error("evalue must be a non-negative number, got: " + evalue);
        }
      } else if (typeof evalue === "string") {
        evalue_re = /^((?:[+]?[0-9]*\.?[0-9]+(?:[eE][-+]?[0-9]+)?)|inf)$/;
        if (!evalue_re.test(evalue)) {
          throw new Error("evalue must be a non-negative number, got: " + evalue);
        }
      } else {
        throw new Error("evalue must be a non-negative number, got: " + evalue);
      }
    }
    // set properties
    this.name = name;
    this.alt = alt;
    this.nsites = nsites;
    this.evalue = evalue;
    this.ltrim = ltrim;
    this.rtrim = rtrim;
    if (typeof matrix === "string") {
      // string constructor
      data = parse_pspm_string(matrix);
      this.alph_length = data["alph_length"];
      this.motif_length = data["motif_length"];
      this.pspm = data["pspm"];
      if (this.evalue == null) {
        if (data["evalue"] != null) {
          this.evalue = data["evalue"];
        } else {
          this.evalue = 0;
        }
      }
      if (this.nsites == null) {
        if (typeof data["nsites"] === "number") {
          this.nsites = data["nsites"];
        } else {
          this.nsites = 20;
        }
      }
    } else {
      // assume pspm is a nested array
      this.motif_length = matrix.length;
      this.alph_length = (matrix.length > 0 ? matrix[0].length : 0);
      if (this.nsites == null) {
        this.nsites = 20;
      }
      if (this.evalue == null) {
        this.evalue = 0;
      }
      this.pspm = [];
      // copy pspm and check
      for (row = 0; row < this.motif_length; row++) {
        if (this.alph_length != matrix[row].length) {
          throw new Error("COLUMN_MISMATCH");
        }
        this.pspm[row] = [];
        row_sum = 0;
        for (col = 0; col < this.alph_length; col++) {
          this.pspm[row][col] = matrix[row][col];
          row_sum += this.pspm[row][col];
        }
        delta = 0.1;
        if (isNaN(row_sum) || (row_sum > 1 && (row_sum - 1) > delta) || 
            (row_sum < 1 && (1 - row_sum) > delta)) {
          throw new Error("INVALID_SUM");
        }
      }
      // copy pssm
      if (pssm != null) {
        this.pssm = [];
        for (row = 0; row < this.motif_length; row++) {
          this.pssm[row] = [];
          for (col = 0; col < this.alph_length; col++) {
            this.pssm[row][col] = pssm[row][col];
          }
        }
      }
    }
  }
};

Pspm.prototype.copy = function() {
  "use strict";
  return new Pspm(this);
};

Pspm.prototype.reverse = function() {
  "use strict";
  var x, y, temp, temp_trim;
  //reverse
  x = 0;
  y = this.motif_length-1;
  while (x < y) {
    temp = this.pspm[x];
    this.pspm[x] = this.pspm[y];
    this.pspm[y] = temp;
    x++;
    y--;
  }
  // reverse pssm (if defined)
  if (typeof this.pssm !== "undefined") {
    //reverse
    x = 0;
    y = this.motif_length-1;
    while (x < y) {
      temp = this.pssm[x];
      this.pspm[x] = this.pssm[y];
      this.pssm[y] = temp;
      x++;
      y--;
    }
  }
  //swap triming
  temp_trim = this.ltrim;
  this.ltrim = this.rtrim;
  this.rtrim = temp_trim;
  return this; //allow function chaining...
};

Pspm.prototype.reverse_complement = function(alphabet) {
  "use strict";
  var x, y, temp, i, row, c, temp_trim;
  if (this.alph_length != alphabet.get_size_core()) {
    throw new Error("The alphabet size does not match the size of the pspm.");
  }
  if (!alphabet.has_complement()) {
    throw new Error("The specified alphabet can not be complemented.");
  }
  // reverse motif
  this.reverse();
  //complement
  for (x = 0; x < this.motif_length; x++) {
    row = this.pspm[x];
    for (i = 0; i < row.length; i++) {
      c = alphabet.get_complement(i);
      if (c < i) continue;
      temp = row[i];
      row[i] = row[c];
      row[c] = temp;
    }
  }
  // complement pssm (if defined)
  if (typeof this.pssm !== "undefined") {
    //complement
    for (x = 0; x < this.motif_length; x++) {
      row = this.pssm[x];
      for (i = 0; i < row.length; i++) {
        c = alphabet.get_complement(i);
        if (c < i) continue;
        temp = row[i];
        row[i] = row[c];
        row[c] = temp;
      }
    }
  }
  return this; //allow function chaining...
};

Pspm.prototype.get_stack = function(position, alphabet, ssc) {
  "use strict";
  var row, stack_ic, alphabet_ic, stack, i, sym;
  if (this.alph_length != alphabet.get_size_core()) {
    throw new Error("The alphabet size does not match the size of the pspm.");
  }
  row = this.pspm[position];
  stack_ic = this.get_stack_ic(position, alphabet);
  if (ssc) stack_ic -= this.get_error(alphabet);
  alphabet_ic = alphabet.get_ic();
  stack = [];
  for (i = 0; i < this.alph_length; i++) {
    sym = new Symbol(i, row[i]*stack_ic/alphabet_ic, alphabet);
    if (sym.get_scale() <= 0) {
      continue;
    }
    stack.push(sym);
  }
  stack.sort(compare_symbol);
  return stack;
};

Pspm.prototype.get_stack_ic = function(position, alphabet) {
  "use strict";
  var row, H, i;
  if (this.alph_length != alphabet.get_size_core()) {
    throw new Error("The alphabet size does not match the size fo the pspm.");
  }
  row = this.pspm[position];
  H = 0;
  for (i = 0; i < this.alph_length; i++) {
    if (row[i] === 0) {
      continue;
    }
    H -= (row[i] * (Math.log(row[i]) / Math.LN2));
  }
  return alphabet.get_ic() - H;
};

Pspm.prototype.get_error = function(alphabet) {
  "use strict";
  if (this.nsites === 0) {
    return 0;
  }
  return (alphabet.get_size_core()-1) / (2 * Math.LN2 * this.nsites);
};

Pspm.prototype.get_motif_length = function() {
  "use strict";
  return this.motif_length;
};

Pspm.prototype.get_alph_length = function() {
  "use strict";
  return this.alph_length;
};

Pspm.prototype.get_left_trim = function() {
  "use strict";
  return this.ltrim;
};

Pspm.prototype.get_right_trim = function() {
  "use strict";
  return this.rtrim;
};

Pspm.prototype.as_best_match = function(alphabet) {
  "use strict";
  var match, odds, best_odds, best_index;
  var i, j;
  match = "";
  for (i = 0; i < this.motif_length; i++) {
    best_index = 0;
    best_odds = this.pspm[i][0] / alphabet.get_bg_freq(0);
    for (j = 1; j < this.alph_length; j++) {
      odds = this.pspm[i][j] / alphabet.get_bg_freq(j);
      if (odds > best_odds) {
        best_odds = odds;
        best_index = j;
      }
    }
    match += alphabet.get_symbol(best_index);
  }
  return match;
};

Pspm.prototype.as_count_matrix = function() {
  "use strict";
  var count, count_text, text;
  var i, j;
  text = "";
  for (i = 0; i < this.motif_length; i++) {
    if (i !== 0) {
      text += "\n";
    }
    for (j = 0; j < this.alph_length; j++) {
      if (j !== 0) {
        text += " ";
      }
      count = Math.round(this.nsites * this.pspm[i][j]);
      count_text = "" + count;
      // pad up to length of 4
      if (count_text.length < 4) {
        text += (new Array(5 - count_text.length)).join(" ") + count_text;
      } else {
        text += count_text;
      }
    }
  }
  return text; 
};

Pspm.prototype.as_probability_matrix = function() {
  "use strict";
  var text;
  var i, j;
  text = "";
  for (i = 0; i < this.motif_length; i++) {
    if (i !== 0) {
      text += "\n";
    }
    for (j = 0; j < this.alph_length; j++) {
      if (j !== 0) {
        text += " ";
      }
      text += this.pspm[i][j].toFixed(6);
    }
  }
  return text; 
};

Pspm.prototype.as_score_matrix = function(alphabet, pseudo) {
  "use strict";
  var me, score, out, row, col, score_text;
  me = this;
  if (typeof this.pssm === "undefined") {
    if (!(typeof alphabet === "object" && alphabet != null && alphabet instanceof Alphabet)) {
      throw new Error("The alphabet is required to generate the pssm.");
    }
    if (typeof pseudo === "undefined") {
      pseudo = 0.01;
    } else if (typeof pseudo !== "number" || pseudo < 0) {
      throw new Error("Expected positive number for pseudocount");
    }
    score = function(row, col) {
      "use strict";
      var p, bg, p2;
      p = me.pspm[row][col];
      bg = alphabet.get_bg_freq(col);
      p2 = (p * me.nsites + bg * pseudo) / (me.nsites + pseudo);
      return (p2 > 0 ? Math.round((Math.log(p2 / bg) / Math.LN2) * 100) : -10000);
    };
  } else {
    score = function(row, col) {
      "use strict";
      return me.pssm[row][col];
    };
  }
  out = "";
  for (row = 0; row < this.motif_length; row++) {
    for (col = 0; col < this.alph_length; col++) {
      if (col !== 0) {
        out += " ";
      }
      score_text = "" + score(row, col);
      // pad out to 6 characters
      if (score_text.length < 6) {
        out += (new Array(7 - score_text.length)).join(" ") + score_text;
      } else {
        out += score_text;
      }
    }
    out += "\n";
  }
  return out;
}

Pspm.prototype.as_pspm = function() {
  "use strict";
  return "letter-probability matrix: alength= " + this.alph_length + 
      " w= " + this.motif_length + " nsites= " + this.nsites + 
      " E= " + (typeof this.evalue === "number" ? 
          this.evalue.toExponential() : this.evalue) + "\n" +
      this.as_probability_matrix();
};

Pspm.prototype.as_pssm = function(alphabet, pseudo) {
  "use strict";
  return "log-odds matrix: alength= " + this.alph_length + 
      " w= " + this.motif_length + 
      " E= " + (typeof this.evalue == "number" ?
          this.evalue.toExponential() : this.evalue) + "\n" +
      this.as_score_matrix(alphabet, pseudo);
};

Pspm.prototype.as_meme = function(options) {
  var with_header, with_pspm, with_pssm, version, alphabet, bg_source, pseudocount, strands;
  var out, alen, i;
  // get the options
  if (typeof options !== "object" || options === null) {
    options = {};
  }
  with_header = (typeof options["with_header"] === "boolean" ? options["with_header"] : false);
  with_pspm = (typeof options["with_pspm"] === "boolean" ? options["with_pspm"] : false);
  with_pssm = (typeof options["with_pssm"] === "boolean" ? options["with_pssm"] : false);
  if (!with_pspm && !with_pssm) with_pspm = true;
  if (with_header) {
    if (typeof options["version"] === "string" && /^\d+(?:\.\d+){0,2}$/.test(options["version"])) {
      version = options["version"];
    } else if (typeof options["version"] === "number") {
      version = options["version"].toFixed(0);
    } else {
      version = "4";
    }
    if (typeof options["strands"] === "number" && options["strands"] === 1) {
      strands = 1;
    } else {
      strands = 2;
    }
    if (typeof options["bg_source"] === "string") {
      bg_source = options["bg_source"];
    } else {
      bg_source = "unknown source";
    }
    if (typeof options["alphabet"] === "object" && options["alphabet"] != null
        && options["alphabet"] instanceof Alphabet) {
      alphabet = options["alphabet"];
    } else {
      throw new Error("The alphabet is required to generate the header.");
    }
  }
  // now create the output
  out = "";
  if (with_header) {
    out = "MEME version " + version + "\n\n";
    out += alphabet.as_meme() + "\n";
    if (alphabet.has_complement()) { // assume DNA has both strands unless otherwise specified
      out += "strands: " + (strands === 1 ? "+" : "+ -") + "\n\n";
    }
    out += "Background letter frequencies (from " + bg_source + "):\n";
    alen = alphabet.get_size_core();
    for (i = 0; i < alen; i++) {
      if (i !== 0) {
        if (i % 9 === 0) { // maximum of nine entries per line
          out += "\n";
        } else {
          out += " ";
        }
      }
      out += alphabet.get_symbol(i) + " " + alphabet.get_bg_freq(i).toFixed(3);
    }
  }
  out += "\n\n";
  out += "MOTIF " + this.name + (this.alt == null ? "" : " " + this.alt);
  if (with_pssm) {
    out += "\n\n";
    out += this.as_pssm(options["alphabet"], options["pseudocount"]);
  }
  if (with_pspm) {
    out += "\n\n";
    out += this.as_pspm();
  }
  return out;
}

Pspm.prototype.toString = function() {
  "use strict";
  var str, i, row;
  str = "";
  for (i = 0; i < this.pspm.length; i++) {
    row = this.pspm[i];
    str += row.join("\t") + "\n";
  }
  return str;
};

function parse_pspm_properties(str) {
  "use strict";
  var parts, i, eqpos, before, after, properties, prop, num, num_re;
  num_re = /^((?:[+]?[0-9]*\.?[0-9]+(?:[eE][-+]?[0-9]+)?)|inf)$/;
  parts = trim(str).split(/\s+/);
  // split up words containing =
  for (i = 0; i < parts.length;) {
    eqpos = parts[i].indexOf("=");
    if (eqpos != -1) {
      before = parts[i].substr(0, eqpos);
      after = parts[i].substr(eqpos+1);
      if (before.length > 0 && after.length > 0) {
        parts.splice(i, 1, before, "=", after);
        i += 3;
      } else if (before.length > 0) {
        parts.splice(i, 1, before, "=");
        i += 2;
      } else if (after.length > 0) {
        parts.splice(i, 1, "=", after);
        i += 2;
      } else {
        parts.splice(i, 1, "=");
        i++;
      }
    } else {
      i++;
    }
  }
  properties = {};
  for (i = 0; i < parts.length; i += 3) {
    if (parts.length - i < 3) {
      throw new Error("Expected PSPM property was incomplete. "+
          "Remaing parts are: " + parts.slice(i).join(" "));
    }
    if (parts[i+1] !== "=") {
      throw new Error("Expected '=' in PSPM property between key and " +
          "value but got " + parts[i+1]); 
    }
    prop = parts[i].toLowerCase();
    num = parts[i+2];
    if (!num_re.test(num)) {
      throw new Error("Expected numeric value for PSPM property '" + 
          prop + "' but got '" + num + "'");
    }
    properties[prop] = num;
  }
  return properties;
}

function parse_pspm_string(pspm_string) {
  "use strict";
  var header_re, lines, first_line, line_num, col_num, alph_length, 
      motif_length, nsites, evalue, pspm, i, line, match, props, parts,
      j, prob;
  header_re = /^letter-probability\s+matrix:(.*)$/i;
  lines = pspm_string.split(/\n/);
  first_line = true;
  line_num = 0;
  col_num = 0;
  alph_length;
  motif_length;
  nsites;
  evalue;
  pspm = [];
  for (i = 0; i < lines.length; i++) {
    line = trim(lines[i]);
    if (line.length === 0) { 
      continue;
    }
    // check the first line for a header though allow matrices without it
    if (first_line) {
      first_line = false;
      match = header_re.exec(line);
      if (match !== null) {
        props = parse_pspm_properties(match[1]);
        if (props.hasOwnProperty("alength")) {
          alph_length = parseFloat(props["alength"]);
          if (alph_length != 4 && alph_length != 20) {
            throw new Error("PSPM property alength should be 4 or 20" +
                " but got " + alph_length);
          }
        }
        if (props.hasOwnProperty("w")) {
          motif_length = parseFloat(props["w"]);
          if (motif_length % 1 !== 0 || motif_length < 1) {
            throw new Error("PSPM property w should be an integer larger " +
                "than zero but got " + motif_length);
          }
        }
        if (props.hasOwnProperty("nsites")) {
          nsites = parseFloat(props["nsites"]);
          if (nsites <= 0) {
            throw new Error("PSPM property nsites should be larger than " +
                "zero but got " + nsites);
          }
        }
        if (props.hasOwnProperty("e")) {
          evalue = props["e"];
          if (evalue < 0) {
            throw new Error("PSPM property evalue should be " +
                "non-negative but got " + evalue);
          }
        }
        continue;
      }
    }
    pspm[line_num] = [];
    col_num = 0;
    parts = line.split(/\s+/);
    for (j = 0; j < parts.length; j++) {
      prob = parseFloat(parts[j]);
      if (prob != parts[j] || prob < 0 || prob > 1) {
        throw new Error("Expected probability but got '" + parts[j] + "'"); 
      }
      pspm[line_num][col_num] = prob;
      col_num++;
    }
    line_num++;
  }
  if (typeof motif_length === "number") {
    if (pspm.length != motif_length) {
      throw new Error("Expected PSPM to have a motif length of " + 
          motif_length + " but it was actually " + pspm.length);
    }
  } else {
    motif_length = pspm.length;
  }
  if (typeof alph_length !== "number") {
    alph_length = pspm[0].length;
    if (alph_length != 4 && alph_length != 20) {
      throw new Error("Expected length of first row in the PSPM to be " +
          "either 4 or 20 but got " + alph_length);
    }
  }
  for (i = 0; i < pspm.length; i++) {
    if (pspm[i].length != alph_length) {
      throw new Error("Expected PSPM row " + i + " to have a length of " + 
          alph_length + " but the length was " + pspm[i].length);
    }
  }
  return {"pspm": pspm, "motif_length": motif_length, 
    "alph_length": alph_length, "nsites": nsites, "evalue": evalue};
}
//======================================================================
// end Pspm object
//======================================================================

//======================================================================
// start Logo object
//======================================================================

var Logo = function(alphabet, options) {
  "use strict";
  this.alphabet = alphabet;
  this.fine_text = "";
  this.x_axis = 1;
  this.y_axis = true;
  this.xlate_nsyms = 1;
  this.xlate_start = null;
  this.xlate_end = null;
  this.pspm_list = [];
  this.pspm_column = [];
  this.rows = 0;
  this.columns = 0;
  if (typeof options === "string") {
    // the old method signature had fine_text here so we support that
    this.fine_text = options;
  } else if (typeof options === "object" && options != null) {
    this.fine_text = (typeof options.fine_text === "string" ? options.fine_text : "");
    this.x_axis = (typeof options.x_axis === "boolean" ? (options.x_axis ? 1 : 0) : 1);
    if (options.x_axis_hidden != null && options.x_axis_hidden) this.x_axis = -1;
    this.y_axis = (typeof options.y_axis === "boolean" ? options.y_axis : true);
    this.xlate_nsyms = (typeof options.xlate_nsyms === "number" ? options.xlate_nsyms : this.xlate_nsyms);
    this.xlate_start = (typeof options.xlate_start === "number" ? options.xlate_start : this.xlate_start);
    this.xlate_end = (typeof options.xlate_end === "number" ? options.xlate_end : this.xlate_end);
  }
};

Logo.prototype.add_pspm = function(pspm, column) {
  "use strict";
  var col;
  if (typeof column === "undefined") {
    column = 0;
  } else if (column < 0) {
    throw new Error("Column index out of bounds.");
  }
  this.pspm_list[this.rows] = pspm;
  this.pspm_column[this.rows] = column;
  this.rows++;
  col = column + pspm.get_motif_length();
  if (col > this.columns) {
    this.columns = col;
  }
};

Logo.prototype.get_columns = function() {
  "use strict";
  return this.columns;
};

Logo.prototype.get_xlate_nsyms = function() {
  "use strict";
  return this.xlate_nsyms;
};

Logo.prototype.get_xlate_start = function() {
  "use strict";
  return (this.xlate_start != null ? this.xlate_start : 0);
};

Logo.prototype.get_xlate_end = function() {
  "use strict";
  return (this.xlate_end != null ? this.xlate_end : this.columns * this.xlate_nsyms);
};

Logo.prototype.get_xlate_columns = function() {
  "use strict";
  return this.get_xlate_end() - this.get_xlate_start();
};

Logo.prototype.get_rows = function() {
  "use strict";
  return this.rows;
};

Logo.prototype.get_pspm = function(row_index) {
  "use strict";
  if (row_index < 0 || row_index >= this.rows) {
    throw new Error("INDEX_OUT_OF_BOUNDS");
  }
  return this.pspm_list[row_index];
};

Logo.prototype.get_offset = function(row_index) {
  "use strict";
  if (row_index < 0 || row_index >= this.rows) {
    throw new Error("INDEX_OUT_OF_BOUNDS");
  }
  return this.pspm_column[row_index];
};

Logo.prototype._as_eps_data = function(ssc, errbars) {
  var i, j, pos, stack_pos, pspm, stack, sym, out;
  out = "";
  for (i = 0; i < this.rows; i++) {
    out += "\nStartLine\n";
    // Indent
    for (j = 0; j < this.pspm_column[i]; j++) {
      out += "() startstack\nendstack\n\n";
    }
    pspm = this.pspm_list[i];
    if (pspm.get_left_trim() > 0) {
      out += "MuteColour\nDrawTrimEdge\n" + pspm.get_left_trim() + " DrawTrimBg\n";
    }
    for (pos = 0; pos < pspm.get_motif_length(); pos++) {
      if (pos != 0 && pos == pspm.get_left_trim()) { // enable full colour
        out += "DrawTrimEdge\nRestoreColour\n";
      } else if (pos == (pspm.get_motif_length() - pspm.get_right_trim())) {
        out += "MuteColour\n" + pspm.get_right_trim() + " DrawTrimBg\n";
      }
      out += "(" + (pos + 1) + ") startstack\n";
      stack = pspm.get_stack(pos, this.alphabet, ssc);
      for (stack_pos = 0; stack_pos < stack.length; stack_pos++) {
        sym = stack[stack_pos];
        out += " " + (sym.get_scale() * this.alphabet.get_ic()) + " (" + sym.get_symbol() + ") numchar\n";
      }
      if (errbars) {
        out += " " + pspm.get_error(this.alphabet) + " Ibeam\n";
      }
      out += "endstack\n\n";
    }
    if (pspm.get_right_trim() > 0 || pspm.get_left_trim() == pspm.get_motif_length()) {
      out += "RestoreColour\n";
    }
    out += "EndLine\n";
  }
  return out;
};

Logo.prototype.as_eps = function(options) {
  "use strict";
  if (this.xlate_nsyms != 1) throw new Error("Unsupported setting xlate_nsyms for EPS");
  if (this.xlate_start != null) throw new Error("Unsupported setting xlate_start for EPS");
  if (this.xlate_end != null) throw new Error("Unsupported setting xlate_end for EPS");

  var LOGOHEIGHT = 7.5; // default height of line in cm
  var cm2pts, height, width, now, ssc, errbars;
  if (typeof options === "undefined") {
    options = {};
  }
  cm2pts = 72 / 2.54;
  if (typeof options.logo_height == "number") {
    height = options.logo_height;
  } else {
    height = LOGOHEIGHT * this.rows;
  }
  if (typeof options.logo_width == "number") {
    width = options.logo_width;
  } else {
    width = this.columns + 2;
  }
  now = new Date();
  ssc = (typeof options.ssc == "boolean" ? options.ssc : false);
  errbars = (typeof options.show_error_bar == "boolean" ? options.show_error_bar : ssc);
  var values = {
    "LOGOHEIGHT": height,
    "LOGOWIDTH": width,
    "BOUNDINGHEIGHT": Math.round(height * cm2pts),
    "BOUNDINGWIDTH": Math.round(width * cm2pts),
    "LOGOLINEHEIGHT": (height / this.rows),
    "CHARSPERLINE": this.columns,
    "BARBITS": this.alphabet.get_ic(),
    "LOGOTYPE": (this.alphabet.has_complement() ? "NA" : "AA"),
    "CREATIONDATE": now.getDate() + "." + (now.getMonth() + 1) + "." + now.getFullYear() + " " + now.getHours() + ":" + now.getMinutes() + ":" + now.getSeconds(),
    "ERRORBARFRACTION": (typeof options.error_bar_fraction == "number" ? options.error_bar_fraction : 1.0),
    "TICBITS": (typeof options.ticbits == "number" ? options.ticbits : 1.0),
    "TITLE": (typeof options.title == "string" ? options.title : ""),
    "FINEPRINT": (typeof options.fineprint == "string" ? options.fineprint : this.fine_text),
    "XAXISLABEL": (typeof options.xaxislabel == "string" ? options.xaxislabel : ""),
    "YAXISLABEL": (typeof options.yaxislabel == "string" ? options.yaxislabel : "bits"),
    "SSC": ssc,
    "YAXIS": (typeof options.show_y_axis == "boolean" ? options.show_y_axis : this.y_axis),
    "SHOWENDS": (typeof options.show_ends == "boolean" ? options.show_ends : false),
    "ERRBAR": errbars,
    "OUTLINE": (typeof options.show_outline == "boolean" ? options.show_outline : false),
    "NUMBERING": (typeof options.show_numbering == "boolean" ? options.show_numbering : this.x_axis != 0),
    "SHOWINGBOX": (typeof options.show_box == "boolean" ? options.show_box : false),
    "CREATOR": (typeof options.creator == "string" ? options.creator : "motif_logo.js"),
    "FONTSIZE": (typeof options.label_font_size == "number" ? options.label_font_size : 12),
    "TITLEFONTSIZE": (typeof options.title_font_size == "number" ? options.title_font_size : 12),
    "SMALLFONTSIZE": (typeof options.small_font_size == "number" ? options.small_font_size : 6),
    "TOPMARGIN" : (typeof options.top_margin == "number" ? options.top_margin : 0.9),
    "BOTTOMMARGIN": (typeof options.bottom_margin == "number" ? options.bottom_margin : 0.9),
    "COLORDICT": this.alphabet._as_eps_dict(),
    "DATA": this._as_eps_data(ssc, errbars)
  };
  // now this requires that the script containing the template has been imported!
  return motif_logo_template(values);
};

//======================================================================
// end Logo object
//======================================================================

// calculate the exact size (in pixels) of an object drawn on the
// canvas assuming that the background of the canvas is transparent.
function canvas_bounds(ctx, cwidth, cheight) {
  "use strict";
  var data, r, c, top_line, bottom_line, left_line, right_line, 
      txt_width, txt_height;

  // extract the image data
  data = ctx.getImageData(0, 0, cwidth, cheight).data;

  // set initial values
  top_line = -1; bottom_line = -1; left_line = -1; right_line = -1;
  txt_width = 0; txt_height = 0;

  // Find the top-most line with a non-transparent pixel
  for (r = 0; r < cheight; r++) {
    for (c = 0; c < cwidth; c++) {
      if (data[r * cwidth * 4 + c * 4 + 3]) {
        top_line = r;
        break;
      }
    }
    if (top_line != -1) {
      break;
    }
  }
  
  // Only bother looking if we found at least one set pixel... 
  if (top_line != -1) {

    //find the last line with a non-transparent pixel
    for (r = cheight-1; r >= top_line; r--) {
      for(c = 0; c < cwidth; c++) {
        if(data[r * cwidth * 4 + c * 4 + 3]) {
          bottom_line = r;
          break;
        }
      }
      if (bottom_line != -1) {
        break;
      }
    }
    // calculate height
    txt_height = bottom_line - top_line + 1;

    // Find the left-most line with a non-transparent pixel
    for (c = 0; c < cwidth; c++) {
      for (r = top_line; r <= bottom_line; r++) {
        if (data[r * cwidth * 4 + c * 4 + 3]) {
          left_line = c;
          break;
        }
      }
      if (left_line != -1) {
        break;
      }
    }

    //find the right most line with a non-transparent pixel
    for (c = cwidth-1; c >= left_line; c--) {
      for(r = top_line; r <= bottom_line; r++) {
        if(data[r * cwidth * 4 + c * 4 + 3]) {
          right_line = c;
          break;
        }
      }
      if (right_line != -1) {
        break;
      }
    }
    txt_width = right_line - left_line + 1;
  }

  //return the bounds
  return {bound_top: top_line, bound_bottom: bottom_line, 
    bound_left: left_line, bound_right: right_line, width: txt_width, 
    height: txt_height};
}

//======================================================================
// start RasterizedAlphabet
//======================================================================

// Rasterize Alphabet
// 1) Measure width of text at default font for all symbols in alphabet
// 2) sort in width ascending
// 3) Drop the top and bottom 10% (designed to ignore outliers like 'W' and 'I')
// 4) Calculate the average as the maximum scaling factor (designed to stop I becoming a rectangular blob).
// 5) Assume scale of zero would result in width of zero, interpolate scale required to make perfect width font
// 6) Draw text onto temp canvas at calculated scale
// 7) Find bounds of drawn text
// 8) Paint on to another canvas at the desired height (but only scaling width to fit if larger).
var RasterizedAlphabet = function(alphabet, logo_scale, font, width) {
  "use strict";
  var default_size, safety_pad, canvas, ctx, middle, baseline, widths, sizes,
      i, sym, size, tenpercent, avg_width, scale, 
      target_width, target_height;
  //variable prototypes
  this.alphabet = alphabet;
  this.scale = logo_scale;
  this.sym_cache = {};
  this.stack_num_cache = [];
  this.scale_num_cache = [];
  // size of canvas
  default_size = 60; // size of measuring canvas
  safety_pad = 20; // pixels to pad around so we don't miss the edges
  // create a canvas to do our measuring
  canvas = document.createElement("canvas");
  if (!canvas.getContext) throw new Error("No canvas support");
  canvas.width = default_size + 2 * safety_pad;
  canvas.height = default_size + 2 * safety_pad;
  middle = Math.round(canvas.width / 2);
  baseline = Math.round(canvas.height - safety_pad);
  ctx = canvas.getContext('2d');
  if (!supports_text(ctx)) throw new Error("Canvas does not support text");
  ctx.font = font;
  ctx.textAlign = "center";
  ctx.translate(middle, baseline);
  // list of widths
  widths = [];
  sizes = [];
  //now measure each letter in the alphabet
  for (i = 0; i < alphabet.get_size_core(); ++i) {
    // reset the canvas
    ctx.clearRect(0, 0, canvas.width, canvas.height);
    ctx.fillStyle = alphabet.get_colour(i);
    // draw the test text
    ctx.fillText(alphabet.get_symbol(i), 0, 0);
    //measure
    size = canvas_bounds(ctx, canvas.width, canvas.height);
    if (size.width === 0) throw new Error("Invisible symbol!");
    widths.push(size.width);
    sizes[i] = size;
  }
  //sort the widths
  widths.sort(function(a,b) {return a - b;});
  //drop 10% of the items off each end
  tenpercent = Math.floor(widths.length / 10);
  for (i = 0; i < tenpercent; ++i) {
    widths.pop();
    widths.shift();
  }
  //calculate average width
  avg_width = 0;
  for (i = 0; i < widths.length; ++i) {
    avg_width += widths[i];
  }
  avg_width /= widths.length;
  // calculate the target width
  target_width = width * this.scale * 2;
  // calculate scales
  for (i = 0; i < alphabet.get_size_core(); ++i) {
    sym = alphabet.get_symbol(i);
    size = sizes[i];
    // calculate scale
    scale = target_width / Math.max(avg_width, size.width);
    // estimate scaled height
    target_height = size.height * scale;
    // create an appropriately sized canvas
    canvas = document.createElement("canvas");
    canvas.width = target_width;
    canvas.height = target_height + safety_pad * 2;
    // calculate the middle
    middle = Math.round(canvas.width / 2);
    // calculate the baseline
    baseline = Math.round(canvas.height - safety_pad);
    // get the context and prepare to draw the rasterized text
    ctx = canvas.getContext('2d');
    ctx.font = font;
    ctx.fillStyle = alphabet.get_colour(i);
    ctx.textAlign = "center";
    ctx.translate(middle, baseline);
    ctx.save();
    ctx.scale(scale, scale);
    // draw the text
    ctx.fillText(sym, 0, 0);
    ctx.restore();
    this.sym_cache[sym] = {"image": canvas, "size": canvas_bounds(ctx, canvas.width, canvas.height)};
  }
};

RasterizedAlphabet.prototype.get_alphabet = function() {
  return this.alphabet;
};

RasterizedAlphabet.prototype.get_scale = function() {
  return this.scale;
};

RasterizedAlphabet.prototype.draw_stack_sym = function(ctx, letter, dx, dy, dWidth, dHeight) {
  "use strict";
  var entry, image, size;
  entry = this.sym_cache[letter];
  image = entry.image;
  size = entry.size;
  ctx.drawImage(image, 0, size.bound_top -1, image.width, size.height+1, dx, dy, dWidth, dHeight);
};

RasterizedAlphabet.prototype.draw_stack_num = function(ctx, font, stack_width, index) {
  var image, image_ctx, text_length;
  if (index >= this.stack_num_cache.length) {
    image = document.createElement("canvas");
    // measure the text
    image_ctx = image.getContext('2d');
    image_ctx.save();
    image_ctx.font = font;
    text_length = image_ctx.measureText("" + (index + 1)).width;
    image_ctx.restore();
    // resize the canvas to fit
    image.width = Math.ceil(stack_width);
    image.height = Math.ceil(text_length);
    // draw the text
    image_ctx = image.getContext('2d');
    image_ctx.translate(Math.round(stack_width / 2), 0);
    image_ctx.font = font;
    image_ctx.textBaseline = "middle";
    image_ctx.textAlign = "right";
    image_ctx.rotate(-(Math.PI / 2));
    image_ctx.fillText("" + (index + 1), 0, 0);
    this.stack_num_cache[index] = image;
  } else {
    image = this.stack_num_cache[index];
  }
  ctx.drawImage(image, 0, 0);
}

RasterizedAlphabet.prototype.draw_scale_num = function(ctx, font, num) {
  var image, image_ctx, text_size, m_length;
  if (num >= this.scale_num_cache.length) {
    image = document.createElement("canvas");
    // measure the text
    image_ctx = image.getContext('2d');
    image_ctx.font = font;
    text_size = image_ctx.measureText("" + num);
    if (text_size.actualBoundingBoxAscent && text_size.actualBoundingBoxDesent) {
      // resize the canvas to fit
      image.width = Math.ceil(text_size.width);
      image.height = Math.ceil(text_size.actualBoundingBoxAscent + text_size.actualBoundingBoxDesent);
      // draw the text
      image_ctx = image.getContext('2d');
      image_ctx.font = font;
      image_ctx.textAlign = "right";
      image_ctx.fillText("" + num, image.width, text_size.actualBoundingBoxAscent);
    } else {
      // measure width of 'm' to approximate height, we double it later anyway
      m_length = image_ctx.measureText("m").width;
      // resize the canvas to fit
      image.width = Math.ceil(text_size.width);
      image.height = Math.ceil(2 * m_length);
      // draw the text
      image_ctx = image.getContext('2d');
      image_ctx.font = font;
      image_ctx.textAlign = "right";
      image_ctx.textBaseline = "middle";
      image_ctx.fillText("" + num, image.width, m_length);
    }
    this.scale_num_cache[num] = image;
  } else {
    image = this.scale_num_cache[num];
  }
  ctx.drawImage(image, -image.width, -Math.round(image.height / 2))
}

//======================================================================
// end RasterizedAlphabet
//======================================================================

//======================================================================
// start LogoMetrics object
//======================================================================

var LogoMetrics = function(ctx, logo_columns, logo_rows, has_names, has_finetext, x_axis, y_axis) {
  "use strict";
  var i, row_height;
  //variable prototypes
  this.pad_top = (has_names ? 5 : 0);
  this.pad_left = (y_axis ? 10 : 0);
  this.pad_right = (has_finetext ? 15 : 0);
  this.pad_bottom = 0;
  this.pad_middle = 20;
  this.name_height = 14;
  this.name_font = "bold " + this.name_height + "px Times, sans-serif";
  this.name_spacer = 0;
  this.y_axis = y_axis;
  this.y_label = "bits";
  this.y_label_height = 12;
  this.y_label_font = "bold " + this.y_label_height + "px Helvetica, sans-serif";
  this.y_label_spacer = 3;
  this.y_num_height = 12;
  this.y_num_width = 0;
  this.y_num_font = "bold " + this.y_num_height + "px Helvetica, sans-serif";
  this.y_tic_width = 5;
  this.stack_pad_left = 0;
  this.stack_font = "bold 25px Helvetica, sans-serif";
  this.stack_height = 90;
  this.stack_width = 26;
  this.stacks_pad_right = 5;
  this.x_axis = x_axis;
  this.x_num_above = 2;
  this.x_num_height = 12;
  this.x_num_width = 0;
  this.x_num_font = "bold " + this.x_num_height + "px Helvetica, sans-serif";
  this.fine_txt_height = 6;
  this.fine_txt_above = 2;
  this.fine_txt_font = "normal " + this.fine_txt_height + "px Helvetica, sans-serif";
  this.letter_metrics = new Array();
  this.summed_width = 0;
  this.summed_height = 0;
  //calculate the width of the y axis numbers
  ctx.font = this.y_num_font;
  for (i = 0; i <= 2; i++) {
    this.y_num_width = Math.max(this.y_num_width, ctx.measureText("" + i).width);
  }
  //calculate the width of the x axis numbers (but they are rotated so it becomes height)
  if (x_axis == 1) {
    ctx.font = this.x_num_font;
    for (i = 1; i <= logo_columns; i++) {
      this.x_num_width = Math.max(this.x_num_width, ctx.measureText("" + i).width);
    }
  } else if (x_axis == 0) {
    this.x_num_height = 4;
    this.x_num_width = 4;
  } else {
    this.x_num_height = 0;
    this.x_num_width = 0;
  }
  
  //calculate how much vertical space we want to draw this
  //first we add the padding at the top and bottom since that's always there
  this.summed_height += this.pad_top + this.pad_bottom;
  //all except the last row have the same amount of space allocated to them
  if (logo_rows > 1) {
    row_height = this.stack_height + this.pad_middle;
    if (has_names) {
      row_height += this.name_height;
      //the label is allowed to overlap into the spacer
      row_height += Math.max(this.y_num_height/2, this.name_spacer); 
      //the label is allowed to overlap the space used by the other label
      row_height += Math.max(this.y_num_height/2, this.x_num_height + this.x_num_above); 
    } else {
      row_height += this.y_num_height/2; 
      //the label is allowed to overlap the space used by the other label
      row_height += Math.max(this.y_num_height/2, this.x_num_height + this.x_num_above); 
    }
    this.summed_height += row_height * (logo_rows - 1);
  }
  //the last row has the name and fine text below it but no padding
  this.summed_height += this.stack_height + (this.y_axis ? this.y_num_height/2 : 0);

  var fine_txt_total = (has_finetext ? this.fine_txt_height + this.fine_txt_above : 0);
  if (has_names) {
    this.summed_height += fine_txt_total + this.name_height;
    this.summed_height += Math.max((this.y_axis ? this.y_num_height/2 : 0), 
        this.x_num_height + this.x_num_above + this.name_spacer);
  } else {
    this.summed_height += Math.max((this.y_axis ? this.y_num_height/2 : 0), 
        this.x_num_height + this.x_num_above + fine_txt_total);
  }

  //calculate how much horizontal space we want to draw this
  //first add the padding at the left and right since that's always there
  this.summed_width += this.pad_left + this.pad_right;
  if (this.y_axis) {
    //add on the space for the y-axis label
    this.summed_width += this.y_label_height + this.y_label_spacer;
    //add on the space for the y-axis
    this.summed_width += this.y_num_width + this.y_tic_width;
  }
  //add on the space for the stacks
  this.summed_width += (this.stack_pad_left + this.stack_width) * logo_columns;
  //add on the padding after the stacks (an offset from the fine text)
  this.summed_width += this.stacks_pad_right;

};

//======================================================================
// end LogoMetrics object
//======================================================================

//found this trick at http://talideon.com/weblog/2005/02/detecting-broken-images-js.cfm
function image_ok(img) {
  "use strict";
  // During the onload event, IE correctly identifies any images that
  // weren't downloaded as not complete. Others should too. Gecko-based
  // browsers act like NS4 in that they report this incorrectly.
  if (!img.complete) {
    return false;
  }
  // However, they do have two very useful properties: naturalWidth and
  // naturalHeight. These give the true size of the image. If it failed
  // to load, either of these should be zero.
  if (typeof img.naturalWidth !== "undefined" && img.naturalWidth === 0) {
    return false;
  }
  // No other way of checking: assume it's ok.
  return true;
}
  
function supports_text(ctx) {
  "use strict";
  if (!ctx.fillText) {
    return false;
  }
  if (!ctx.measureText) {
    return false;
  }
  return true;
}

//draws the scale, returns the width
function draw_scale(ctx, metrics, alphabet_ic, raster) {
  "use strict";
  var tic_height, i;
  tic_height = metrics.stack_height / alphabet_ic;
  ctx.save();
  ctx.translate(metrics.y_label_height, metrics.y_num_height/2);
  //draw the axis label
  ctx.save();
  ctx.font = metrics.y_label_font;
  ctx.translate(0, metrics.stack_height/2);
  ctx.rotate(-(Math.PI / 2));
  ctx.textAlign = "center";
  ctx.fillText("bits", 0, 0);
  ctx.restore();

  ctx.translate(metrics.y_label_spacer + metrics.y_num_width, 0);

  //draw the axis tics
  ctx.save();
  ctx.translate(0, metrics.stack_height);
  for (i = 0; i <= alphabet_ic; i++) {
    //draw the number
    ctx.save();
    ctx.translate(-1, 0);
    raster.draw_scale_num(ctx, metrics.y_num_font, i);
    ctx.restore();
    //draw the tic
    ctx.fillRect(0, -1, metrics.y_tic_width, 2);
    //prepare for next tic
    ctx.translate(0, -tic_height);
  }
  ctx.restore();

  ctx.fillRect(metrics.y_tic_width - 2, 0, 2, metrics.stack_height)

  ctx.restore();
}

function draw_stack_num(ctx, metrics, row_index, raster) {
  "use strict";
  ctx.save();
  ctx.translate(0, Math.round(metrics.stack_height + metrics.x_num_above));
  if (metrics.x_axis == 1) {
    raster.draw_stack_num(ctx, metrics.x_num_font, metrics.stack_width, row_index);
  } else if (metrics.x_axis == 0) {
    // draw dots instead of the numbers (good for small logos)
    ctx.beginPath();
    var radius = Math.round(metrics.x_num_height / 2);
    ctx.arc(Math.round(metrics.stack_width / 2), radius, radius, 0, 2 * Math.PI, false);
    ctx.fill();
  }
  ctx.restore();
}

function draw_stack(ctx, metrics, symbols, raster) {
  "use strict";
  var preferred_pad, sym_min, i, sym, sym_height, pad;
  preferred_pad = 0;
  sym_min = 5;

  ctx.save();//1
  ctx.translate(0, metrics.stack_height);
  for (i = 0; i < symbols.length; i++) {
    sym = symbols[i];
    sym_height = metrics.stack_height * sym.get_scale();
    
    pad = preferred_pad;
    if (sym_height - pad < sym_min) {
      pad = Math.min(pad, Math.max(0, sym_height - sym_min));
    }
    sym_height -= pad;

    //translate to the correct position
    ctx.translate(0, -(pad/2 + sym_height));

    //draw
    raster.draw_stack_sym(ctx, sym.get_symbol(), 0, 0, metrics.stack_width, sym_height);
    //translate past the padding
    ctx.translate(0, -(pad/2));
  }
  ctx.restore();//1
}

function draw_dashed_line(ctx, pattern, start, x1, y1, x2, y2) {
  "use strict";
  var x, y, len, i, dx, dy, tlen, theta, mulx, muly, lx, ly;
  dx = x2 - x1;
  dy = y2 - y1;
  tlen = Math.pow(dx*dx + dy*dy, 0.5);
  theta = Math.atan2(dy,dx);
  mulx = Math.cos(theta);
  muly = Math.sin(theta);
  lx = [];
  ly = [];
  for (i = 0; i < pattern; ++i) {
    lx.push(pattern[i] * mulx);
    ly.push(pattern[i] * muly);
  }
  i = start;
  x = x1;
  y = y1;
  len = 0;
  ctx.beginPath();
  while (len + pattern[i] < tlen) {
    ctx.moveTo(x, y);
    x += lx[i];
    y += ly[i];
    ctx.lineTo(x, y);
    len += pattern[i];
    i = (i + 1) % pattern.length;
    x += lx[i];
    y += ly[i];
    len += pattern[i];
    i = (i + 1) % pattern.length;
  }
  if (len < tlen) {
    ctx.moveTo(x, y);
    x += mulx * (tlen - len);
    y += muly * (tlen - len);
    ctx.lineTo(x, y);
  }
  ctx.stroke();
}

function draw_trim_background(ctx, metrics, left_start, left_end, left_divider, right_start, right_end, right_divider) {
  "use strict";
  var left_size = left_end - left_start;
  var right_size = right_end - right_start;
  var line_x;

  ctx.save();//s8
  ctx.fillStyle = "rgb(240, 240, 240)";
  if (left_size > 0) {
    ctx.fillRect(left_start * metrics.stack_width, 0, left_size * metrics.stack_width, metrics.stack_height);
  }
  if (right_size > 0) {
    ctx.fillRect(right_start * metrics.stack_width, 0, right_size * metrics.stack_width, metrics.stack_height);
  }
  ctx.fillStyle = "rgb(51, 51, 51)";
  if (left_size > 0 && left_divider) {
    line_x = (left_end * metrics.stack_width) - 0.5;
    draw_dashed_line(ctx, [3], 0, line_x, 0, line_x, metrics.stack_height);
  }
  if (right_size > 0 && right_divider) {
    line_x = (right_start * metrics.stack_width) + 0.5;
    draw_dashed_line(ctx, [3], 0, line_x, 0, line_x, metrics.stack_height);
  }
  ctx.restore();//s8
}

function size_logo_on_canvas(logo, canvas, show_names, scale) {
  "use strict";
  var draw_name, draw_finetext, metrics;
  draw_name = (typeof show_names === "boolean" ? show_names : (logo.get_rows() > 1));
  draw_finetext = (logo.fine_text.length > 0);
  if (canvas.width !== 0 && canvas.height !== 0) {
    return;
  }
  metrics = new LogoMetrics(canvas.getContext('2d'), 
      logo.get_xlate_columns(), logo.get_rows(), draw_name, draw_finetext, logo.x_axis, logo.y_axis);
  if (typeof scale == "number") {
    //resize the canvas to fit the scaled logo
    canvas.width = metrics.summed_width * scale;
    canvas.height = metrics.summed_height * scale;
  } else {
    if (canvas.width === 0 && canvas.height === 0) {
      canvas.width = metrics.summed_width;
      canvas.height = metrics.summed_height;
    } else if (canvas.width === 0) {
      canvas.width = metrics.summed_width * (canvas.height / metrics.summed_height);
    } else if (canvas.height === 0) {
      canvas.height = metrics.summed_height * (canvas.width / metrics.summed_width);
    }
  }
}

function draw_logo_on_canvas(logo, canvas, show_names, scale) {
  "use strict";
  var i, draw_name, draw_finetext, ctx, metrics, raster, pspm_i, pspm, 
      offset, col_index, motif_position, ssc;
  ssc = false;
  draw_name = (typeof show_names === "boolean" ? show_names : (logo.get_rows() > 1));
  draw_finetext = (logo.fine_text.length > 0);
  ctx = canvas.getContext('2d');
  //assume that the user wants the canvas scaled equally so calculate what the best width for this image should be
  metrics = new LogoMetrics(ctx, logo.get_xlate_columns(), logo.get_rows(), draw_name, draw_finetext, logo.x_axis, logo.y_axis);
  if (typeof scale == "number") {
    //resize the canvas to fit the scaled logo
    canvas.width = metrics.summed_width * scale;
    canvas.height = metrics.summed_height * scale;
  } else {
    if (canvas.width === 0 && canvas.height === 0) {
      scale = 1;
      canvas.width = metrics.summed_width;
      canvas.height = metrics.summed_height;
    } else if (canvas.width === 0) {
      scale = canvas.height / metrics.summed_height;
      canvas.width = metrics.summed_width * scale;
    } else if (canvas.height === 0) {
      scale = canvas.width / metrics.summed_width;
      canvas.height = metrics.summed_height * scale;
    } else {
      scale = Math.min(canvas.width / metrics.summed_width, canvas.height / metrics.summed_height);
    }
  }
  // cache the raster based on the assumption that we will be drawing a lot
  // of logos the same size and alphabet
  if (typeof draw_logo_on_canvas.raster_cache === "undefined") {
    draw_logo_on_canvas.raster_cache = [];
  }
  for (i = 0; i < draw_logo_on_canvas.raster_cache.length; i++) {
    raster = draw_logo_on_canvas.raster_cache[i];
    if (raster.get_alphabet().equals(logo.alphabet) &&
        Math.abs(raster.get_scale() - scale) < 0.1) break;
    raster = null;
  }
  if (raster == null) {
    raster = new RasterizedAlphabet(logo.alphabet, scale, metrics.stack_font, metrics.stack_width);
    draw_logo_on_canvas.raster_cache.push(raster);
  }
  ctx = canvas.getContext('2d');
  ctx.save();//s1
  ctx.scale(scale, scale);
  ctx.save();//s2
  ctx.save();//s7
  //create margin
  ctx.translate(Math.round(metrics.pad_left), Math.round(metrics.pad_top));
  for (pspm_i = 0; pspm_i < logo.get_rows(); ++pspm_i) {
    pspm = logo.get_pspm(pspm_i);
    offset = logo.get_offset(pspm_i);
    //optionally draw name if this isn't the last row or is the only row 
    if (draw_name && (logo.get_rows() == 1 || pspm_i != (logo.get_rows()-1))) {
      ctx.save();//s4
      ctx.translate(Math.round(metrics.summed_width/2), Math.round(metrics.name_height));
      ctx.font = metrics.name_font;
      ctx.textAlign = "center";
      ctx.fillText(pspm.name, 0, 0);
      ctx.restore();//s4
      ctx.translate(0, Math.round(metrics.name_height + 
          Math.min(0, metrics.name_spacer - metrics.y_num_height/2)));
    }
    //draw scale
    if (logo.y_axis) draw_scale(ctx, metrics, logo.alphabet.get_ic(), raster);
    ctx.save();//s5
    //translate across past the scale
    if (logo.y_axis) {
      ctx.translate(Math.round(metrics.y_label_height + metrics.y_label_spacer + 
        metrics.y_num_width + metrics.y_tic_width), Math.round(metrics.y_num_height / 2));
    }
    //draw the trimming background
    if (pspm.get_left_trim() > 0 || pspm.get_right_trim() > 0) {
      var left_start = offset * logo.get_xlate_nsyms();
      var left_end = (offset + pspm.get_left_trim()) * logo.get_xlate_nsyms();
      var left_divider = true;
      if (left_end < logo.get_xlate_start() || left_start > logo.get_xlate_end()) {
        // no overlap
        left_start = 0;
        left_end = 0;
        left_divider = false;
      } else {
        if (left_start < logo.get_xlate_start()) {
          left_start = logo.get_xlate_start();
        }
        if (left_end > logo.get_xlate_end()) {
          left_end = logo.get_xlate_end();
          left_divider = false;
        }
        left_start -= logo.get_xlate_start();
        left_end -= logo.get_xlate_start();
        if (left_end < left_start) {
          left_start = 0;
          left_end = 0;
          left_divider = false;
        }
      }
      var right_end = (offset + pspm.get_motif_length()) * logo.get_xlate_nsyms();
      //var right_start = right_end - (pspm.get_left_trim() * logo.get_xlate_nsyms());
      var right_start = right_end - (pspm.get_right_trim() * logo.get_xlate_nsyms());
      var right_divider = true;
      if (right_end < logo.get_xlate_start() || right_start > logo.get_xlate_end()) {
        // no overlap
        right_start = 0;
        right_end = 0;
        right_divider = false;
      } else {
        if (right_start < logo.get_xlate_start()) {
          right_start = logo.get_xlate_start();
          right_divider = false;
        }
        if (right_end > logo.get_xlate_end()) {
          right_end = logo.get_xlate_end();
        }
        right_start -= logo.get_xlate_start();
        right_end -= logo.get_xlate_start();
        if (right_end < right_start) {
          right_start = 0;
          right_end = 0;
          right_divider = false;
        }
      }
      draw_trim_background(ctx, metrics, left_start, left_end, left_divider, right_start, right_end, right_divider);
    }
    //draw letters
    var xlate_col;
    for (xlate_col = logo.get_xlate_start(); xlate_col < logo.get_xlate_end(); xlate_col++) {
      ctx.translate(metrics.stack_pad_left,0);
      col_index = Math.floor(xlate_col / logo.get_xlate_nsyms());
      if (xlate_col % logo.get_xlate_nsyms() == 0) {
        if (col_index >= offset && col_index < (offset + pspm.get_motif_length())) {
          motif_position = col_index - offset;
          draw_stack_num(ctx, metrics, motif_position, raster);
          draw_stack(ctx, metrics, pspm.get_stack(motif_position, logo.alphabet, ssc), raster);
        }
      } else {
        if (col_index >= offset && col_index < (offset + pspm.get_motif_length())) {
          ctx.save();// s5.1
          ctx.translate(0, Math.round(metrics.stack_height));
          // TODO draw a dot or dash or something to indicate continuity of the motif
          ctx.restore(); //s5.1
        }
      }
      ctx.translate(Math.round(metrics.stack_width), 0);
    }
    ctx.restore();//s5
    ////optionally draw name if this is the last row but isn't the only row 
    if (draw_name && (logo.get_rows() != 1 && pspm_i == (logo.get_rows()-1))) {
      //translate vertically past the stack and axis's        
      ctx.translate(0, metrics.y_num_height/2 + metrics.stack_height + 
          Math.max(metrics.y_num_height/2, metrics.x_num_above + metrics.x_num_width + metrics.name_spacer));

      ctx.save();//s6
      ctx.translate(metrics.summed_width/2, metrics.name_height);
      ctx.font = metrics.name_font;
      ctx.textAlign = "center";
      ctx.fillText(pspm.name, 0, 0);
      ctx.restore();//s6
      ctx.translate(0, metrics.name_height);
    } else {
      //translate vertically past the stack and axis's        
      ctx.translate(0, metrics.y_num_height/2 + metrics.stack_height + 
          Math.max(metrics.y_num_height/2, metrics.x_num_above + metrics.x_num_width));
    }
    //if not the last row then add middle padding
    if (pspm_i != (logo.get_rows() -1)) {
      ctx.translate(0, metrics.pad_middle);
    }
  }
  ctx.restore();//s7
  if (logo.fine_text.length > 0) {
    ctx.translate(metrics.summed_width - metrics.pad_right, metrics.summed_height - metrics.pad_bottom);
    ctx.font = metrics.fine_txt_font;
    ctx.textAlign = "right";
    ctx.fillText(logo.fine_text, 0,0);
  }
  ctx.restore();//s2
  ctx.restore();//s1
}

function create_canvas(c_width, c_height, c_id, c_title, c_display) {
  "use strict";
  var canvas = document.createElement("canvas");
  //check for canvas support before attempting anything
  if (!canvas.getContext) {
    return null;
  }
  var ctx = canvas.getContext('2d');
  //check for html5 text drawing support
  if (!supports_text(ctx)) {
    return null;
  }
  //size the canvas
  canvas.width = c_width;
  canvas.height = c_height;
  canvas.id = c_id;
  canvas.title = c_title;
  canvas.style.display = c_display;
  return canvas;
}

function logo_1(alphabet, fine_text, pspm) {
  "use strict";
  var logo = new Logo(alphabet, fine_text);
  logo.add_pspm(pspm);
  return logo;
}

function logo_2(alphabet, fine_text, target, query, query_offset) {
  "use strict";
  var logo = new Logo(alphabet, fine_text);
  if (query_offset < 0) {
    logo.add_pspm(target, -query_offset);
    logo.add_pspm(query);
  } else {
    logo.add_pspm(target);
    logo.add_pspm(query, query_offset);
  }      
  return logo;
}

/*
 * Specifies an alternate source for an image.
 * If the image with the image_id specified has
 * not loaded then a generated logo will be used 
 * to replace it.
 *
 * Note that the image must either have dimensions
 * or a scale must be set.
 */
function alternate_logo(logo, image_id, scale) {
  "use strict";
  var image = document.getElementById(image_id);
  if (!image) {
    alert("Can't find specified image id (" +  image_id + ")");
    return;
  }
  //if the image has loaded then there is no reason to use the canvas
  if (image_ok(image)) {
    return;
  }
  //the image has failed to load so replace it with a canvas if we can.
  var canvas = create_canvas(image.width, image.height, image_id, image.title, image.style.display);
  if (canvas === null) {
    return;
  }
  //draw the logo on the canvas
  draw_logo_on_canvas(logo, canvas, null, scale);
  //replace the image with the canvas
  image.parentNode.replaceChild(canvas, image);
}

/*
 * Specifies that the element with the specified id
 * should be replaced with a generated logo.
 */
function replace_logo(logo, replace_id, scale, title_txt, display_style) {
  "use strict";
  var element = document.getElementById(replace_id);
  if (!replace_id) {
    alert("Can't find specified id (" + replace_id + ")");
    return;
  }
  //found the element!
  var canvas = create_canvas(50, 120, replace_id, title_txt, display_style);
  if (canvas === null) {
    return;
  }
  //draw the logo on the canvas
  draw_logo_on_canvas(logo, canvas, null, scale);
  //replace the element with the canvas
  element.parentNode.replaceChild(canvas, element);
}

/*
 * Fast string trimming implementation found at
 * http://blog.stevenlevithan.com/archives/faster-trim-javascript
 *
 * Note that regex is good at removing leading space but
 * bad at removing trailing space as it has to first go through
 * the whole string.
 */
function trim (str) {
  "use strict";
  var ws, i;
  str = str.replace(/^\s\s*/, '');
  ws = /\s/; i = str.length;
  while (ws.test(str.charAt(--i)));
  return str.slice(0, i + 1);
}
</script>
    <script>
var tomtom_alphabet = new Alphabet(data.alphabet, data.background);

var DelayLogoTask = function(logo, canvas) {
  this.logo = logo;
  this.canvas = canvas;
};

DelayLogoTask.prototype.run = function () {
  draw_logo_on_canvas(this.logo, this.canvas);
};

function make_logo(alphabet, pspm, rc, offset, className) {
  if (rc) pspm = pspm.copy().reverse_complement(alphabet);
  var logo = new Logo(alphabet, "");
  logo.add_pspm(pspm, offset);
  var canvas = document.createElement('canvas');
  canvas.height = 50;
  canvas.width = 0;
  canvas.className = className;
  size_logo_on_canvas(logo, canvas);
  add_draw_task(canvas, new DelayLogoTask(logo, canvas));
  return canvas;
}

function make_name(motif, should_link) {
  var name, link;
  name = motif.id + (typeof motif.alt === "string" ? " (" + motif.alt + ")" : "");
  if (should_link && typeof motif.url === "string") {
    link = document.createElement("a");
    link.href = motif.url;
    link.appendChild(document.createTextNode(name));
    return link;
  } else {
    return document.createTextNode(name);
  }
}

function make_logo_form() {
  $("logo_form").action = site_url + "/utilities/generate_logo";
  $("download_submit").addEventListener("click", function() {
    toggle_class(document.getElementById("download"), "hidden", true);
  }, false);
  $("download_cancel").addEventListener("click", function() {
    toggle_class(document.getElementById("download"), "hidden", true);
  }, false);
}

function make_alignment(query, target, rc, offset) {
  var logo, query_pspm, target_pspm;
  logo = new Logo(tomtom_alphabet, "");
  query_pspm = new Pspm(query.pwm, query.id, 0, 0, query.nsites);
  target_pspm = new Pspm(target.pwm, target.id, 0, 0, target.nsites);
  if (rc) target_pspm.reverse_complement(tomtom_alphabet);
  logo.add_pspm(target_pspm, (offset < 0 ? -offset : 0));
  logo.add_pspm(query_pspm, (offset < 0 ? 0 : offset));
  var canvas = document.createElement('canvas');
  canvas.height = 300;
  canvas.width = 0;
  canvas.title = "Click to show download options";
  size_logo_on_canvas(logo, canvas);
  add_draw_task(canvas, new DelayLogoTask(logo, canvas));
  return canvas;
}

function make_preview() {
  var i, j, qidx, tidx, query, target, match, matches, pview_table, pview_tbody, pview_row;
  var row, row_mlist, mlink;
  // scan the matches make a lookup from query index to matches index
  var lookup = {};
  for (i = 0; i < data.all_matches.length; i++) {
    lookup[data.all_matches[i].idx] = i;
  }

  pview_table = $("preview");
  pview_row = pview_table.querySelector(".pview_row");
  pview_tbody = pview_row.parentNode;
  pview_tbody.removeChild(pview_row);
  for (qidx = 0; qidx < data.queries.length; qidx++) {
    query = data.queries[qidx];
    matches = (lookup[qidx] != null ? data.all_matches[lookup[qidx]].matches : []);
    row = pview_row.cloneNode(true);
    row.querySelector(".pview_db").appendChild(document.createTextNode(data.query_dbs[query.db].name));
    row.querySelector(".pview_name").appendChild(document.createTextNode(query.id));
    if (typeof query.alt === "string") row.querySelector(".pview_alt").appendChild(document.createTextNode(query.alt));
    row.querySelector(".pview_logo").appendChild(make_logo(tomtom_alphabet, new Pspm(query.pwm)));
    row.querySelector(".pview_matches").appendChild(document.createTextNode(matches.length));
    row_mlist = row.querySelector(".pview_list");
    for (j = 0; j < matches.length; j++) {
      if (j > 0) row_mlist.appendChild(document.createTextNode(",\u2003 "));// EM Space
      match = matches[j];
      tidx = match.idx;
      target = data.targets[tidx];
      mlink = document.createElement("a");
      mlink.className = (qidx % 2 == 0 ? "ml1" : "ml2");
      mlink.appendChild(document.createTextNode(target.id));
      if (typeof target.alt === "string") mlink.appendChild(document.createTextNode("\u00A0(" + target.alt + ")"));
      mlink.href = "#match_" + qidx + "_" + tidx;
      row_mlist.appendChild(mlink);
    }
    pview_tbody.appendChild(row);
  }
}

function make_target_dbs() {
  var i, tdb_table, tdb_row, tdb_tbody, db;
  var row, match_count;
  tdb_table = $("tdbs");
  tdb_row = tdb_table.querySelector(".db_row");
  tdb_tbody = tdb_row.parentNode;
  tdb_tbody.removeChild(tdb_row);
  match_count = [];
  for (i = 0; i < data.target_dbs.length; i++) match_count[i] = 0;
  for (i = 0; i < data.targets.length; i++) {
    match_count[data.targets[i].db]++;
  }
  for (i = 0; i < data.target_dbs.length; i++) {
    db = data.target_dbs[i];
    row = tdb_row.cloneNode(true);
    row.querySelector(".db_name").appendChild(document.createTextNode(db.name));
    row.querySelector(".db_used").appendChild(document.createTextNode(db.loaded - db.excluded));
    row.querySelector(".db_matched").appendChild(document.createTextNode(match_count[i]));
    tdb_tbody.appendChild(row);
  }
  $("link_after_target_db").href = (data.all_matches.length > 0 ? "#query_" + data.all_matches[0].idx : "#settings");
}

function custom_logo(elem, qidx, tidx, rc, offset) {
  "use strict";
  function helper(qidx, tidx, rc, offset) {
    "use strict";
    return function() {
      if ($("dl_flip").value == "1") {
        $("dl_rc1").value = (rc ? "0" : "1");
        $("dl_rc2").value = "1";
        $("dl_shift").value = -(data.targets[tidx].len - (data.queries[qidx].len + offset));
      } else {
        $("dl_rc1").value = (rc ? "1" : "0");
        $("dl_rc2").value = "0";
        $("dl_shift").value = -offset;
      }
    };
  }
  var download_prompt, qidx, tidx, rc, offset, query, target, qmotif, tmotif;
  var flip_handler;
  // get the download prompt
  download_prompt = document.getElementById("download");
  // hide previous showing of the download prompt
  toggle_class(download_prompt, "hidden", true);
  if (typeof custom_logo.flip_handler !== "undefined") {
    $("dl_flip").removeEventListener("change", custom_logo.flip_handler, false);
  }
  // reset defaults on prompt
  $("dl_flip").value = "0";
  $("dl_width").value = "";
  $("dl_height").value = "";
  // configure download prompt to the selected logo
  query = data.queries[qidx];
  target = data.targets[tidx];
  tmotif = new Pspm(target.pwm, "1", 0, 0, target.nsites, target.evalue);
  qmotif = new Pspm(query.pwm, "2", 0, 0, query.nsites, query.evalue);
  $("dl_motifs").value = tmotif.as_meme({"with_header": true, "alphabet": tomtom_alphabet}) + qmotif.as_meme();
  $("dl_label1").value = target.id;
  $("dl_label2").value = query.id;
  flip_handler = helper(qidx, tidx, rc, offset);
  $("dl_flip").addEventListener("change", flip_handler, false);
  custom_logo.flip_handler = flip_handler;
  flip_handler();
  // position and display the download prompt
  position_popup(elem, download_prompt, 1);
  toggle_class(download_prompt, "hidden", false);
  // focus the download button
  $("download_submit").focus();
}

function make_custom_logo_handler(elem, qidx, tidx, rc, offset) {
  return function(evt) {
    custom_logo(elem, qidx, tidx, rc, offset);
    evt.preventDefault();
  };
}

function make_matches() {
  var i, j, matches_box, match_box, match_entry, box, links, entries, entry;
  var qidx, query, tidx, target, matches, overlap, rc, logo_container;
  var prev_query_link, next_query_link;
  matches_box = $("matches");
  match_box = matches_box.querySelector(".match_box");
  matches_box.removeChild(match_box);
  for (i = 0; i < data.all_matches.length; i++) {
    matches = data.all_matches[i].matches;
    qidx = data.all_matches[i].idx;
    query = data.queries[qidx];
    box = match_box.cloneNode(true);
    box.id = "query_" + qidx;
    box.querySelector(".query_name").appendChild(make_name(query, false));
    links = box.querySelector(".links");
    prev_query_link = (i == 0 ? "#target_dbs" : "#query_" + data.all_matches[i-1].idx);
    next_query_link = ((i + 1) >= data.all_matches.length ? "#settings" : "#query_" + data.all_matches[i+1].idx);
    links.querySelector(".prev").href = prev_query_link;
    links.querySelector(".next").href = next_query_link;
    match_entry = box.querySelector(".match_entry");
    entries = match_entry.parentNode;
    entries.removeChild(match_entry);
    for (j = 0; j < matches.length; j++) {
      tidx = matches[j].idx;
      target = data.targets[tidx];
      entry = match_entry.cloneNode(true);
      entry.id = "match_" + qidx + "_" + tidx;
      entry.querySelector(".match_name").appendChild(make_name(target, true));
      entry.querySelector(".match_db").appendChild(document.createTextNode(data.target_dbs[target.db].name));
      entry.querySelector(".match_pvalue").appendChild(document.createTextNode(matches[j].pv));
      entry.querySelector(".match_evalue").appendChild(document.createTextNode(matches[j].ev));
      entry.querySelector(".match_qvalue").appendChild(document.createTextNode(matches[j].qv));
      if (matches[j].off < 0) {
        overlap = Math.min(query.pwm.length + matches[j].off, target.pwm.length);
      } else if (matches[j].off == 0) {
        overlap = Math.min(query.pwm.length, target.pwm.length);
      } else {
        overlap = Math.min(query.pwm.length, target.pwm.length - matches[j].off);
      }
      entry.querySelector(".match_overlap").appendChild(document.createTextNode(overlap));
      entry.querySelector(".match_offset").appendChild(document.createTextNode(matches[j].off));
      rc = (typeof matches[j].rc === "boolean" && matches[j].rc);
      entry.querySelector(".match_orientation").appendChild(document.createTextNode(rc ? "Reverse Complement" : "Normal"));
      logo_container = entry.querySelector(".logo_container");
      logo_container.appendChild(make_alignment(query, target, rc, matches[j].off));
      entries.appendChild(entry);
      var custom_logo_handler = make_custom_logo_handler(logo_container.querySelector("canvas"), qidx, tidx, rc, matches[j].off);
      entry.querySelector(".download_btn").addEventListener("click", custom_logo_handler, false);
      entry.querySelector(".download_text").addEventListener("click", custom_logo_handler, false);
      entry.querySelector("canvas").addEventListener("click", custom_logo_handler, false);
      if (i != 0) entry.querySelector(".prev_query").href = prev_query_link;
      if ((i + 1) < data.all_matches.length) entry.querySelector(".next_query").href = next_query_link;
      if (j != 0) {
        entry.querySelector(".prev_target").href = "#match_" + qidx + "_" + matches[j-1].idx;
      } else if (i != 0) {
        var prev_query =  data.all_matches[i-1];
        var prev_qidx = prev_query.idx;
        var prev_matches = prev_query.matches;
        var prev_tidx = prev_matches[prev_matches.length - 1].idx;
        entry.querySelector(".prev_target").href = "#match_" + prev_qidx + "_" + prev_tidx;
      }
      if ((j + 1) < matches.length) {
        entry.querySelector(".next_target").href = "#match_" + qidx + "_" + matches[j+1].idx;
      } else if ((i + 1) < data.all_matches.length) {
        var next_query = data.all_matches[i+1];
        var next_qidx = next_query.idx;
        var next_matches = next_query.matches;
        var next_tidx = next_matches[0].idx;
        entry.querySelector(".next_target").href = "#match_" + next_qidx + "_" + next_tidx;
      }
    }

    matches_box.appendChild(box);
  }

}

function make_program() {
  $("link_before_program").href = (data.all_matches.length > 0 ? "#query_" + data.all_matches[data.all_matches.length - 1].idx : "#target_dbs");
  $("version").appendChild(document.createTextNode(data.version));
  $("release").appendChild(document.createTextNode(data.release));
  $("cmd").value = data.cmd.join(" ");
  $("runtime").appendChild(document.createTextNode(data.runtime.seconds));
}
</script>
    <style>
/* The following is the content of meme.css */
body { background-color:white; font-size: 12px; font-family: Verdana, Arial, Helvetica, sans-serif;}

div.help {
  display: inline-block;
  margin: 0px;
  padding: 0px;
  width: 12px;
  height: 13px;
  cursor: pointer;
  background-image: url(data:image/gif;base64,R0lGODlhDAANAIABANR0AP///yH5BAEAAAEALAAAAAAMAA0AAAIdhI8Xy22MIFgv1DttrrJ7mlGNNo4c+aFg6SQuUAAAOw==);
}

div.help:hover {
  background-image: url(data:image/gif;base64,R0lGODlhDAANAKEAANR0AP///9R0ANR0ACH+EUNyZWF0ZWQgd2l0aCBHSU1QACH5BAEAAAIALAAAAAAMAA0AAAIdDGynCe3PgoxONntvwqz2/z2K2ImjR0KhmSIZUgAAOw==);
}

p.spaced { line-height: 1.8em;}

span.citation { font-family: "Book Antiqua", "Palatino Linotype", serif; color: #004a4d;}

p.pad { padding-left: 30px; padding-top: 5px; padding-bottom: 10px;}

td.jump { font-size: 13px; color: #ffffff; background-color: #00666a;
  font-family: Georgia, "Times New Roman", Times, serif;}

a.jump { margin: 15px 0 0; font-style: normal; font-variant: small-caps;
  font-weight: bolder; font-family: Georgia, "Times New Roman", Times, serif;}

h2.mainh {font-size: 1.5em; font-style: normal; margin: 15px 0 0;
  font-variant: small-caps; font-family: Georgia, "Times New Roman", Times, serif;}

h2.line {border-bottom: 1px solid #CCCCCC; font-size: 1.5em; font-style: normal;
  margin: 15px 0 0; padding-bottom: 3px; font-variant: small-caps;
  font-family: Georgia, "Times New Roman", Times, serif;}

h4 {border-bottom: 1px solid #CCCCCC; font-size: 1.2em; font-style: normal;
  margin: 10px 0 0; padding-bottom: 3px; font-family: Georgia, "Times New Roman", Times, serif;}

h5 {margin: 0px}

a.help { font-size: 9px; font-style: normal; text-transform: uppercase;
  font-family: Georgia, "Times New Roman", Times, serif;}

div.pad { padding-left: 30px; padding-top: 5px; padding-bottom: 10px;}

div.pad1 { margin: 10px 5px;}

div.pad2 { margin: 25px 5px 5px;}
h2.pad2 { padding: 25px 5px 5px;}

div.pad3 { padding: 5px 0px 10px 30px;}

div.box { border: 2px solid #CCCCCC; padding:10px; overflow: hidden;}

div.bar { border-left: 7px solid #00666a; padding:5px; margin-top:25px; }

div.subsection {margin:25px 0px;}

img {border:0px none;}

th.majorth {text-align:left;}
th.minorth {font-weight:normal; text-align:left; width:8em; padding: 3px 0px;}
th.actionth {font-weight:normal; text-align:left;}

.explain h5 {font-size:1em; margin-left: 1em;}

div.doc {margin-left: 2em; margin-bottom: 3em;}

th.trainingset {
  border-bottom: thin dashed black; 
  font-weight:normal; 
  padding:0px 10px;
}
div.pop_content {
  position:absolute;
  z-index:50;
  width:300px;
  padding: 5px;
  background: #E4ECEC;
  font-size: 12px;
  font-family: Arial;
  border-style: double;
  border-width: 3px;
  border-color: #AA2244;
  display:none;
}

div.pop_content > *:first-child {
  margin-top: 0px;
}

div.pop_content h1, div.pop_content h2, div.pop_content h3, div.pop_content h4, 
div.pop_content h5, div.pop_content h6, div.pop_content p {
  margin: 0px;
}

div.pop_content p + h1, div.pop_content p + h2, div.pop_content p + h3, 
div.pop_content p + h4, div.pop_content p + h5, div.pop_content p + h6 {
  margin-top: 5px;
}

div.pop_content p + p {
  margin-top: 5px;
}

div.pop_content > *:last-child {
  margin-bottom: 0px;
}

div.pop_content div.pop_close {
  /* old definition */
  float:right;
  bottom: 0;
}

div.pop_content span.pop_close, div.pop_content span.pop_back {
  display: inline-block;
  border: 2px outset #661429;
  background-color: #CCC;
  padding-left: 1px;
  padding-right: 1px;
  padding-top: 0px;
  padding-bottom: 0px;
  cursor: pointer;
  color: #AA2244; /*#661429;*/
  font-weight: bold;
}

div.pop_content span.pop_close:active, div.pop_content span.pop_back:active {
  border-style: inset;
}

div.pop_content span.pop_close {
  float:right;
  /*border: 2px outset #AA002B;*/
  /*color: #AA2244;*/
}

div.pop_content:not(.nested) .nested_only {
  display: none;
}

div.pop_back_sec {
  margin-bottom: 5px;
}

div.pop_close_sec {
  margin-top: 5px;
}

table.hide_advanced tr.advanced {
  display: none;
}
span.show_more {
  display: none;
}
table.hide_advanced span.show_more {
  display: inline;
}
table.hide_advanced span.show_less {
  display: none;
}


/*****************************************************************************
 * Program logo styling
 ****************************************************************************/
div.prog_logo {
  border-bottom: 0.25em solid #0f5f60;
  height: 4.5em;
  width: 24em;
  display:inline-block;
}
div.prog_logo img {
  float:left;
  width: 4em;
  border-style: none;
  margin-right: 0.2em;
}
div.prog_logo h1, div.prog_logo h1:hover, div.prog_logo h1:active, div.prog_logo h1:visited {
  margin:0;
  padding:0;
  font-family: Arial, Helvetica,  sans-serif;
  font-size: 3.2em;
  line-height: 1em;
  vertical-align: top;
  display: block;
  color: #026666;
  letter-spacing: -0.06em;
  text-shadow: 0.04em 0.06em 0.05em #666;
}
div.prog_logo h2, div.prog_logo h2:hover, div.prog_logo h2:active, div.prog_logo h2:visited {
  display: block;
  margin:0;
  padding:0;
  font-family: Helvetica, sans-serif;
  font-size: 0.9em;
  line-height: 1em;
  letter-spacing: -0.06em;
  color: black;
}

div.big.prog_logo {
  font-size: 18px;
}

</style>
    <style>
div.header {
  position: relative;
  overflow: hidden;
  margin-top: 15px;
  margin-bottom: 5px;
  margin-right: 3px;
  margin-left: 3px;
}
div.header > h2 {
  font-size: 1.5em;
  font-style: normal;
  margin: 0;
  font-variant: small-caps; 
  font-family: Georgia, "Times New Roman", Times, serif;
}
div.header > span {
  position: absolute;
  right: 0;
  bottom: 0;
}

table.th_ul th {
  white-space: nowrap;
  font-size: 1.2em;
  font-style: normal;
  font-family: Georgia, "Times New Roman", Times, serif;
}

table.th_ul th > span {
  display: block;
  border-bottom: 1px solid #CCCCCC;
  margin-right: 3px;
  padding-bottom: 1px; 
}

table.targets td {
  padding: 0 10px;
}
table.preview td {
  padding: 0 10px;
}
table.preview tbody td {
  padding-bottom: 10px;
}
.ac {
  text-align: center;
}
.downloadTd {
  padding-left:20px;
}
div.logo_container {
}
table.match_summary tbody tr:first-child td, table.match_summary tbody tr:first-child th {
  padding-top: 20px;
}

/* motif list link, first style */
a.ml1 {
}
a.ml2 {
}
div.ml {
  line-height: 1.8em;
  height: 3.6em;
  overflow-y: auto;
}
td.ml div {

}

table.match_summary {
  width: 100%;
}

table.match_summary th {
  min-width: 10em;
}

table.match_summary div.help, table.dl_opts div.help {
  opacity: 0.0;
    -moz-transition: opacity 0.5s;
    -webkit-transition: opacity 0.5s;
    -o-transition: opacity 0.5s;
    transition: opacity 0.5s;
}

table.match_summary tr:hover div.help, table.dl_opts tr:hover div.help {
  opacity: 1.0;
}

#download {
  position:absolute;
  display: inline-block;
  z-index:9;
  padding: 5px;
  background-color: #FFF;
  border-style: double;
  border-width: 5px;
  border-color: #00666a;
}

#download.hidden {
  visibility: hidden;
}

div.custom_logo {
  text-align: center;
  margin-top: 20px;
}

div.logo_container {
  position: relative;
}

div.logo_container canvas {
  cursor: pointer;
}

a.download_text {
  display: block;
  margin-top: 5px;
  margin-bottom: 20px;
  color: #00c;
  text-align: center;
}
a.download_text:hover { 
  color: #00c;
}
a.download_text:active {
  color: #c00;
}

a.prev_query, a.prev_target, a.next_target, a.next_query, a.download_btn {
  font-family: arial;
  font-size: xx-large;
  text-decoration: none;
  color: #000;
}
a.prev_query:hover, a.prev_target:hover, a.next_target:hover, a.next_query:hover, a.download_btn:hover {
  background: #000;
  color: #FFF;
}

a.prev_query {
  position: absolute;
  display: inline-block;
  right:0;
  top:0;
}
a.prev_target {
  position: absolute;
  display: inline-block;
  right:0;
  top: 30%;
  transform: translateY(-50%);
}
a.download_btn {
  position: absolute;
  display: inline-block;
  right:0;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
}
a.next_target {
  position: absolute;
  display: inline-block;
  right:0;
  top: 70%;
  transform: translateY(-50%);
}
a.next_query {
  position: absolute;
  display: inline-block;
  right:0;
  bottom:0;
}

a.prev_target:not([href]), a.next_target:not([href]), a.prev_query:not([href]), a.next_query:not([href]) {
  color: #BBB;
  cursor: pointer;
}
a.prev_target:hover:not([href]), a.next_target:hover:not([href]), a.prev_query:hover:not([href]), a.next_query:hover:not([href]) {
  color: #FFF;
  background: #BBB;
}

table.inputs, table.alpha_bg_table {
  margin-top: 20px;
  border-collapse:collapse;
}
table.inputs * td, table.inputs * th, table.alpha_bg_table * td, table.alpha_bg_table * th {
  padding-left: 15px;
  padding-right: 15px;
  padding-top: 1px;
  padding-bottom: 1px;
}

span.strand_none, span.strand_given, span.strand_both, span.dist_allr,
    span.dist_ed, span.dist_kullback, span.dist_pearson, span.dist_sandelin,
    span.dist_blic1, span.dist_blic5, span.dist_llr1, span.dist_llr5,
    span.ttype_evalue, span.ttype_qvalue {
  display: none;
}

td.none span.strand_none, td.given span.strand_given, td.both span.strand_both,
    td.allr span.dist_allr, td.ed span.dist_ed, td.kullback span.dist_kullback, 
    td.pearson span.dist_pearson, td.sandelin span.dist_sandelin,
    td.blic1 span.dist_blic1, td.blic5 span.dist_blic5, td.llr1 span.dist_llr1,
    td.llr5 span.dist_llr5, td.evalue span.ttype_evalue, td.qvalue span.ttype_qvalue {
  display: inline;
}
</style>
  </head>
  <body data-scrollpad="true">
    <div id="grey_out_page" class="grey_background" style="display:none;"></div>
    <!-- {{{ help topics -->
    <div class="pop_content" id="pop_results_tsv">
      <script>print_doc("pop_results_tsv", "tomtom-results-tsv");</script>
      <div class="pop_close">[<a href="javascript:help_popup()">close</a> ]</div>
    </div>

    <div class="pop_content" id="pop_query_db">
      <script>print_doc_para("pop_query_db", "motif-db", "the query motif(s). Tomtom removes the '.meme' file name extension, if present.");</script>
      <div class="pop_close">[<a href="javascript:help_popup()">close</a> ]</div>
    </div>

    <div class="pop_content" id="pop_query_name">
      <script>print_doc_para("pop_query_name", "motif-id", "query");</script>
      <div class="pop_close">[<a href="javascript:help_popup()">close</a> ]</div>
    </div>
    
    <div class="pop_content" id="pop_query_alt">
      <script>print_doc_para("pop_query_alt", "motif-alt-id", "query");</script>
      <div class="pop_close">[<a href="javascript:help_popup()">close</a> ]</div>
    </div>
    
    <div class="pop_content" id="pop_query_web">
      <p>A link to more information about the query motif.</p>
      <div class="pop_close">[<a href="javascript:help_popup()">close</a> ]</div>
    </div>

    <div class="pop_content" id="pop_motif_consensus">
      <script>print_doc("pop_motif_consensus", "motif-consensus");</script>
      <div class="pop_close">[<a href="javascript:help_popup()">close</a> ]</div>
    </div>

    <div class="pop_content" id="pop_query_preview">
      <p>The motif preview. On supporting browsers this will display as a motif
      logo, otherwise the <a href="javascript:help_refine('pop_motif_consensus')">consensus</a> sequence will be displayed.</p>
      <div class="pop_close">[<a href="javascript:help_popup()">close</a> ]</div>
    </div>

    <div class="pop_content" id="pop_query_matches">
      <p>The number motifs in the target database with a significant match to the query motif.</p>
      <div class="pop_close">[<a href="javascript:help_popup()">close</a> ]</div>
    </div>

    <div class="pop_content" id="pop_query_list">
      <p>Links to the (up to) twenty target motifs with the most significant matches to the query motif.</p>
      <div class="pop_close">[<a href="javascript:help_popup()">close</a> ]</div>
    </div>

    <div class="pop_content" id="pop_db_name">
      <script>print_doc_para("pop_db_name", "motif-db", "target motifs. Tomtom removes the '.meme' file name extension, if present.");</script>
    <div class="pop_close">[<a href="javascript:help_popup()">close</a> ]</div>
    </div>
    
    <div class="pop_content" id="pop_db_used">
      <p>The number of motifs read from the motif database minus the number that
      had to be discarded due to conflicting IDs.</p>
      <div class="pop_close">[<a href="javascript:help_popup()">close</a> ]</div>
    </div>
    
    <div class="pop_content" id="pop_db_matched">
      <p>The number of motifs in this database that have a significant match to at least one of the query motifs.</p>
      <div class="pop_close">[<a href="javascript:help_popup()">close</a> ]</div>
    </div>
    
    <div class="pop_content" id="pop_match_summary">
      <p>The summary gives information about the target motif. Mouse over each
      row to show further help buttons for each specific title.</p>
      <div class="pop_close">[<a href="javascript:help_popup()">close</a> ]</div>
    </div>
    
    <div class="pop_content" id="pop_match_name">
      <p>The ID of the target motif with the optional alternate ID shown in parentheses.</p>
      <div class="pop_close">[<a href="javascript:help_popup()">close</a> ]</div>
    </div>
    
    <div class="pop_content" id="pop_match_db">
      <script>print_doc_para("pop_match_db", "motif-db", "the matched motif. Tomtom removes the '.meme' file name extension, if present.");</script>
      <div class="pop_close">[<a href="javascript:help_popup()">close</a> ]</div>
    </div>
    
    <div class="pop_content" id="pop_match_pvalue">
      <script>print_doc_para("pop_match_pvalue", "tomtom-p-value");</script>
      <div class="pop_close">[<a href="javascript:help_popup()">close</a> ]</div>
    </div>
    
    <div class="pop_content" id="pop_match_evalue">
      <script>print_doc_para("pop_match_evalue", "tomtom-E-value");</script>
      <div class="pop_close">[<a href="javascript:help_popup()">close</a> ]</div>
    </div>
    
    <div class="pop_content" id="pop_match_qvalue">
      <script>print_doc_para("pop_match_qvalue", "tomtom-q-value");</script>
      <div class="pop_close">[<a href="javascript:help_popup()">close</a> ]</div>
    </div>
    
    <div class="pop_content" id="pop_match_overlap">
      <script>print_doc_para("pop_match_overlap", "tomtom-overlap");</script>
      <div class="pop_close">[<a href="javascript:help_popup()">close</a> ]</div>
    </div>
    
    <div class="pop_content" id="pop_match_offset">
      <script>print_doc_para("pop_match_offset", "tomtom-offset");</script>
      <div class="pop_close">[<a href="javascript:help_popup()">close</a> ]</div>
    </div>
    
    <div class="pop_content" id="pop_match_orientation">
      <script>print_doc_para("pop_match_orientation", "tomtom-orientation", "<br>A value of 'Normal' means that the target motif is as it appears in the database. A value of 'Reverse Complement' means that the reverse complement of the target motif is shown.");</script>
      <div class="pop_close">[<a href="javascript:help_popup()">close</a> ]</div>
    </div>
    
    <div class="pop_content" id="pop_match_alignment">
      <p>The image shows the optimal alignment of the two motifs. The sequence logo
      of the target motif is shown aligned above the logo for the query motif.</p>
      <div class="pop_close">[<a href="javascript:help_popup()">close</a> ]</div>
    </div>
    
    <div class="pop_content" id="pop_match_download">
      <p>By clicking the link "Create custom LOGO &#8615;" a form to make custom logos 
      will be displayed. The download button can then be clicked to generate a motif
      matching the selected specifications.</p>
      <div class="pop_close">[<a href="javascript:help_popup()">close</a> ]</div>
    </div>
    
    <div class="pop_content" id="pop_dl_type">
      <p>Two image formats, png and eps, are available. The pixel based portable
      network graphic (png) format is commonly used on the Internet and the
      Encapsulated PostScript (eps) format is more suitable for publications
      that might require scaling.</p>
      <div class="pop_close">[<a href="javascript:help_popup()">close</a> ]</div>
    </div>
    
    <div class="pop_content" id="pop_dl_err">
      <p>Toggle error bars indicating the confidence of a motif based on the
      number of sites used in its creation.</p>
      <div class="pop_close">[<a href="javascript:help_popup()">close</a> ]</div>
    </div>
    
    <div class="pop_content" id="pop_dl_ssc">
      <p>Toggle adding pseudocounts for <b>S</b>mall <b>S</b>ample 
      <b>C</b>orrection.</p>
      <div class="pop_close">[<a href="javascript:help_popup()">close</a> ]</div>
    </div>
    
    <div class="pop_content" id="pop_dl_flip">
      <p>Toggle a full reverse complement of the alignment.</p>
      <div class="pop_close">[<a href="javascript:help_popup()">close</a> ]</div>
    </div>
    
    <div class="pop_content" id="pop_dl_width">
      <p>Specify the width of the generated logo.</p>
      <div class="pop_close">[<a href="javascript:help_popup()">close</a> ]</div>
    </div>

    <div class="pop_content" id="pop_dl_height">
      <p>Specify the height of the generated logo.</p>
      <div class="pop_close">[<a href="javascript:help_popup()">close</a> ]</div>
    </div>

    <div class="pop_content" id="pop_alph_name">
      <script>print_doc_para('pop_alph_name', 'alph-name', 'The ');</script>
      <div class="pop_close">[<a href="javascript:help_popup()">close</a> ]</div>
    </div>
    <div class="pop_content" id="pop_alph_bg">
      <script>print_doc_para('pop_alph_bg', 'alph-bg', 'The ');</script>
      <div class="pop_close">[<a href="javascript:help_popup()">close</a> ]</div>
    </div>

    <!-- }}} -->
    <div id="download" class="hidden">
      <form id="logo_form" method="post" action="">
        <input type="hidden" name="program" value="Tomtom"/>
        <input type="hidden" name="motifs" id="dl_motifs" value=""/>
        <input type="hidden" name="id1" value="1"/>
        <input type="hidden" name="rc1" id="dl_rc1" value="0"/>
        <input type="hidden" name="label1" id="dl_label1" value=""/>
        <input type="hidden" name="id2" value="2"/>
        <input type="hidden" name="rc2" id="dl_rc2" value="0"/>
        <input type="hidden" name="label2" id="dl_label2" value=""/>
        <input type="hidden" name="shift" id="dl_shift" value="0"/>
        <table class="dl_opts">
          <tr>
            <th>Image Type <div class="help" data-topic="pop_dl_type"></div></th>
            <td>
              <select name="png">
                <option value="1" selected>PNG</option>
                <option value="0">EPS</option>
              </select>
            </td>
          </tr>
          <tr>
            <th>Error bars <div class="help" data-topic="pop_dl_err"></div></th>
            <td>
              <select name="errbars">
                <option value="1" selected>yes</option>
                <option value="0">no</option>
              </select>
            </td>
          </tr>
          <tr>
            <th>SSC <div class="help" data-topic="pop_dl_ssc"></div></th>
            <td>
              <select name="ssc">
                <option value="1">yes</option>
                <option value="0" selected>no</option>
              </select>
            </td>
          </tr>
          <tr>
            <th>Flip <div class="help" data-topic="pop_dl_flip"></div></th>
            <td>
              <select id="dl_flip">
                <option value="1">yes</option>
                <option value="0" selected>no</option>
              </select>
            </td>
          </tr>
          <tr>
            <th>Width <div class="help" data-topic="pop_dl_width"></div></th>
            <td>
              <input name="width" id="dl_width" type="text" size="3" placeholder="auto"/>
            </td>
          </tr>
          <tr>
            <th>Height <div class="help" data-topic="pop_dl_height"></div></th>
            <td>
              <input name="height" id="dl_height" type="text" size="3" placeholder="auto"/>
            </td>
          </tr>
        </table>
        <input type="submit" id="download_submit" value="download"/>&nbsp;&nbsp;<input type="button" id="download_cancel" value="cancel"/>
      </form>
      <script>make_logo_form()</script>
    </div>

    <div class="pad1">
    <div class="prog_logo big">
    <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAIAAABMXPacAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9wLHAI4Nh+WUs4AAAA8dEVYdENvbW1lbnQAIEltYWdlIGdlbmVyYXRlZCBieSBHTlUgR2hvc3RzY3JpcHQgKGRldmljZT1wbm1yYXcpCszMtoUAACAASURBVHja7L13nF5llQf+Pee5963Te2bSew9JSCCFIh3pXVBAVxFRQF1hFdTVdV377loAKwosCoKAAtJ7D2mUhCSkZ1Km93nLvfc55/fHfd+Zd0ooyrq/z+/ze5nwSWbu3Pvc5/Rzvuc8pKp4/x9VtQgykhIWELOYCLsODCkREZQACi8EEQCBeOJ55Oe+DShUEBglEhPleIRcQBWwkLSklIXAClGAlR24MUQp/GUCoBACIUCQ0YxwIADDDFtiAjGHXAAK6MCDgYHFDVwKUO4PoLn3kwCBQJQ0gKcKVmPguOQaNjTsBn/Hx/mbf9PAiWosqxkBhCWrWVGOcBRKBFYM7JYCxGAXrgd/6D1IiYjJqrUwhlig+S0Id40JUIKvvgPHQe7NFSCCQK0KBp8ybFNVYQEDGEDfYcMUJBAolFRVrVhVEVghqyxKgCrBOOREKfYBbv3fRQAiUlXDxsCIipISwcJmxTNkHBgiA5CqEignZCNWnpcRDRAQiDUy8hqFEggETzxDERADRCAhDTQI1BcCAFbSgr3RoYQkECAD3A5AQvqGZFbNwhNSzREdIAFUoeFPI4i4HDEw+V/CB0iFv5EAqkpERMYVJ0AgsCEZVDl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OL6kVkw3W15e4n76dSpBQlTC/sR+uqqqfD4QizsVdS8XIYr/YfAPurEq+S/IlLliw555xzkuxax9EdO7XTxBTdunWbOXNmOBxq86v+fxuANidELBZj5lgsFolE7r///o5GfZMLS+fOnRcvXszMnud5nidH3tXh8FPKtY1S/lUAtm7d+uabb7700ktr166tq6trcbJt+d+RkuhIq7el/6tSyiSocX369LnoootGjRp1wgknWICh1V8/cq7vGv9LGIjFlym7B//000+XLl26du3aLVu22Fni+34SLfgakNJuYLTWwWAwEAj07du3srJy4sSJubm5duY5KYXNEXodBgC2VdRrOgzg+35dXV19fX1zc3N1dfUnn3xSW1u7Z8+eurq6aDSaRG/y8/PLyspKSkqKioqOPfbYoqKigoKCwsJCS2BJvg0dTyw89Ot/AHy3hsLr1jX2AAAAAElFTkSuQmCC" alt="Tomtom Logo">
    <h1>Tomtom</h1>
    <h2>Motif Comparison Tool</h2>
    </div>
    <p>
      For further information on how to interpret these results please access
      <a href="http://meme-suite.org/doc/tomtom-output-format.html">http://meme-suite.org/doc/tomtom-output-format.html</a>.<br />
      To get a copy of the MEME software please access 
      <a href="http://meme-suite.org">http://meme-suite.org</a>.
    </p>
    <p>If you use TOMTOM in your research, please cite the following paper:<br>
      <span class="citation">
        Shobhit Gupta, JA Stamatoyannopolous, Timothy Bailey and William Stafford Noble,
        "Quantifying similarity between motifs",
        <i>Genome Biology</i>, <b>8</b>(2):R24, 2007.
        <a href="http://genomebiology.com/2007/8/2/R24">[full text]</a>
      </span>
    </p>
    </div>

    <div class="pad2">
      <a class="jump" href="#query_motifs">Query Motifs</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a
        class="jump" href="#target_dbs">Target Databases</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a
        class="jump" href="#matches">Matches</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a
        class="jump" href="#settings">Settings</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a
        class="jump" href="#program">Program information</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a
        class="jump" href="tomtom.tsv">Results in TSV Format</a>&nbsp;<span id="results_tsv"></span>&nbsp;<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAQCAMAAAAyEe/dAAAACVBMVEX//wAAAAD////s2cV/AAAAdUlEQVQYlXVRBxLAIAhL+P+jC2HZhXcBZEWEldDsZcLIcAhHWWnK8SDcWQhMFUHdAQ1CqQ5+CWPmlHojl+nCJNRtzu4qRc3IUzmTVpXYK0nox0z0PI1stgchdK7lEv7ekhvalw8WW547Gyzedt/2/gLx8WXjXF/1AYFriNAWAAAAAElFTkSuQmCC" alt="NEW" id="new_1">
          &nbsp;&nbsp;|&nbsp;&nbsp;<a
        class="jump" href="tomtom.xml">Results in XML Format</a>
      <script>
        make_help_button($("results_tsv"), "pop_results_tsv");
      </script>
    </div>

    <div id="query_motifs" class="header">
      <h2>Query Motifs</h2>
      <span><a href="#target_dbs">Next</a>&nbsp;<a href="#">Top</a></span>
    </div>
    <div class="box">
      <table id="preview" class="preview th_ul">
        <thead>
          <tr>
          <th><span>Database <div class="help" data-topic="pop_query_db"></div></span></th>
          <th><span>ID <div class="help" data-topic="pop_query_name"></div></span></th>
          <th><span>Alt. ID <div class="help" data-topic="pop_query_alt"></div></span></th>
          <th><span>Preview <div class="help" data-topic="pop_query_preview"></div></span></th>
          <th><span>Matches <div class="help" data-topic="pop_query_matches"></div></span></th>
          <th><span>List <div class="help" data-topic="pop_query_list"></div></span></th>
          </tr>
        </thead>
        <tbody>
          <tr class="pview_row">
          <td class="pview_db"></td>
          <td class="pview_name"></td>
          <td class="pview_alt"></td>
          <td class="pview_logo"></td>
          <td class="pview_matches"></td>
          <td><div class="ml pview_list"></div></td>
          </tr>
        </tbody>
      </table>
      <script>make_preview();</script>
    </div>

    <div id="target_dbs" class="header">
      <h2>Target Databases</h2>
      <span><a href="#query_motifs">Previous</a>&nbsp;<a id="link_after_target_db" href="#">Next</a>&nbsp;<a href="#">Top</a></span>
    </div>
    <div class="box">
      <table id="tdbs" class="targets th_ul">
      <thead>
        <tr>
          <th><span>Database <div class="help" data-topic="pop_db_name"></div></span></th>
          <th><span>Used <div class="help" data-topic="pop_db_used"></div></span></th>
          <th><span>Matched <div class="help" data-topic="pop_db_matched"></div></span></th>
        </tr>
      </thead>
      <tbody>
        <tr class="db_row">
          <td class="db_name"></td>
          <td class="db_used ac"></td>
          <td class="db_matched ac"></td>
        </tr>
      </tbody>
      </table>
      <script>make_target_dbs();</script>
    </div>

    <div id="matches">
      <div class="match_box">
        <div class="header">
          <h2>Matches to <span class="query_name"></span></h2>
          <span class="links"><a class="prev" href="#">Previous</a>&nbsp;<a class="next" href="#">Next</a>&nbsp;<a href="#">Top</a></span>
        </div>
        <div class="box">
          <table class="th_ul" style="width:100%">
            <col style="width: 5em;">
            <col>
            <tbody class="match_entry">
              <tr>
                <th style="text-align:left;"><span>Summary <div class="help" data-topic="pop_match_summary"></div></span></th>
                <th style="text-align:left;"><span>Optimal Alignment <div class="help" data-topic="pop_match_alignment"></div></span></th>
              </tr>
              <tr>
                <td style="vertical-align:top">
                  <table class="match_summary">
                    <tbody>
                      <tr>
                        <th>Name <div class="help" data-topic="pop_match_name"></div></th>
                        <td class="match_name"></td>
                      </tr>
                      <tr>
                        <th>Database <div class="help" data-topic="pop_match_db"></div></th>
                        <td class="match_db"></td>
                      </tr>
                    </tbody>
                    <tbody>
                      <tr>
                        <th><i>p</i>-value <div class="help" data-topic="pop_match_pvalue"></div></th>
                        <td class="match_pvalue"></td>
                      </tr>
                      <tr>
                        <th><i>E</i>-value <div class="help" data-topic="pop_match_evalue"></div></th>
                        <td class="match_evalue"></td>
                      </tr>
                      <tr>
                        <th><i>q</i>-value <div class="help" data-topic="pop_match_qvalue"></div></th>
                        <td class="match_qvalue"></td>
                      </tr>
                    </tbody>
                    <tbody>
                      <tr>
                        <th>Overlap <div class="help" data-topic="pop_match_overlap"></div></th>
                        <td class="match_overlap"></td>
                      </tr>
                      <tr>
                        <th>Offset <div class="help" data-topic="pop_match_offset"></div></th>
                        <td class="match_offset"></td>
                      </tr>
                      <tr>
                        <th>Orientation <div class="help" data-topic="pop_match_orientation"></div></th>
                        <td class="match_orientation"></td>
                      </tr>
                    </tbody>
                  </table>
                  <a class="download_text" href="#">Show logo download options</a>
                </td>
                <td>
                  <div class="logo_container">
                    <a title="Previous query" class="prev_query">&#x2912;</a>
                    <a title="Previous match" class="prev_target">&#x21A5;</a>
                    <a title="Show logo download options" class="download_btn">&#x21D8;</a>
                    <a title="Next match" class="next_target">&#x21A7;</a>
                    <a title="Next query" class="next_query">&#x2913;</a>
                  </div>
                </td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
    </div>
    <script>make_matches();</script>

    <div id="settings" class="header">
      <h2>Settings</h2>
      <span><a id="link_before_program" href="#">Previous</a>&nbsp;<a href="#program">Next</a>&nbsp;<a href="#">Top</a></span>
    </div>
    <div class="box">
      <h4>Alphabet</h4>
      <span id="bg_source"></span>
      <span id="alpha_bg"></span>
      <script>
      {
        $("bg_source").appendChild(make_background_source("Source", data.options.background_source));
        $("alpha_bg").appendChild(make_alpha_bg_table(tomtom_alphabet));
      }
      </script>
      <h4>Other Settings</h4>
      <table id="tbl_settings" class="inputs hide_advanced">
        <tr>
          <th>Strand Handling</th>
          <td id="opt_strand">
            <span class="strand_none">Reverse complements are not possible so motifs are compared as they are provided.</span>
            <span class="strand_given">Motifs are compared as they are provided.</span>
            <span class="strand_both">Motifs may be reverse complemented before comparison to find a better match.</span>
          </td>
        </tr>
        <tr>
          <th>Distance Measure</th>
          <td id="opt_dist">
            <span class="dist_allr">Average log-likelihood ratio</span>
            <span class="dist_ed">Euclidean distance</span>
            <span class="dist_kullback">Kullback-Leibler divergence</span>
            <span class="dist_pearson">Pearson correlation coefficient</span>
            <span class="dist_sandelin">Sandelin-Wasserman function</span>
            <span class="dist_blic1">Bayesian Likelihood 2-Components score (from 1-component Dirichlet prior)</span>
            <span class="dist_blic5">Bayesian Likelihood 2-Components score (from 5-component Dirichlet prior)</span>
            <span class="dist_llr1">Log likelihood Ratio score (from 1-component Dirichlet prior)</span>
            <span class="dist_llr5">Log likelihood Ratio score (from 5-component Dirichlet prior)</span>
          </td>
        </tr>
        <tr>
          <th>Match Threshold</th>
          <td id="opt_ttype">
            Matches must have a <span class="ttype_evalue"><i>E</i>-value</span><span class="ttype_qvalue">q-value</span> of <span id="opt_thresh"></span> or smaller.
          </td>
        </tr>
      </table>
      <script>
      {
        $("opt_strand").className = (tomtom_alphabet.has_complement() ? (data.options.strands == "both" ? "both" : "given") : "none");
        $("opt_dist").className = data.options.distance_measure;
        $("opt_ttype").className = data.options.threshold_type;
        $("opt_thresh").textContent = data.options.threshold_value;
      }
      </script>
    </div>

    <div id="program" class="bar">
      <div style="text-align:right;"><a href="#settings">Previous</a> <a href="#">Top</a></div>
      <div class="subsection">
        <h5>TOMTOM version</h5>
        <span id="version"></span> (Release date: <span id="release"></span>)
      </div>
      <div class="subsection">
        <h5>Reference</h5>
        <span class="citation">
          Shobhit Gupta, JA Stamatoyannopolous, Timothy Bailey and William Stafford Noble,
          "Quantifying similarity between motifs",
          <i>Genome Biology</i>, <b>8</b>(2):R24, 2007.
        </span>
      </div>
      <div class="subsection">
        <h5>Command line</h5>
        <textarea id="cmd" rows="1" style="width:100%;" readonly></textarea><br>
        <br>Result calculation took <span id="runtime"></span> seconds<br>
      </div>
    </div>
    <script>make_program();</script>
  </body>
</html>
